我的profiles.xml出了什么问题?

yeg*_*256 5 maven-2

这是我的一部分profiles.xmlmvn:

<profilesXml>
  <profiles>
    <profile>
      <id>production</id>
      <build>
        <plugins> .. </plugins>
      </build>
    </profile>
  </profiles>
</profilesXml>
Run Code Online (Sandbox Code Playgroud)

mvn就是说:

Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException: 
Unrecognised tag: 'build' (position: START_TAG seen ...</id>\n
        <build>... @32:20)
Run Code Online (Sandbox Code Playgroud)

这有什么不对?

Pas*_*ent 16

该错误消息在这里给你正确的反馈,你不能指定<build/>在部分外部轮廓,你只允许指定<properties>,<pluginRepositories><repositories>.从构建配置文件简介:

外部文件中的配置文件

在外部文件中指定的配置文件(即in settings.xmlprofiles.xml)在最严格的意义上不可移植.任何看起来很有可能改变构建结果的东西都只限于POM中的内联配置文件.像存储库列表这样的东西可能只是已批准工件的专有存储库,并且不会改变构建的结果.因此,您只能修改<repositories><pluginRepositories>部分,以及额外的<properties>部分.

<properties>部分允许您指定自由形式的键值对,这些键值对将包含在POM的插值过程中.这允许您以形式指定插件配置 ${profile.provided.path}.

如果您的代码段来自一本书,那么该书应该是固定的.