what's wrong with my profiles.xml?

[亡魂溺海] 提交于 2019-12-07 05:06:12

问题


This is a portion of my profiles.xml for mvn:

<profilesXml>
  <profiles>
    <profile>
      <id>production</id>
      <build>
        <plugins> .. </plugins>
      </build>
    </profile>
  </profiles>
</profilesXml>

This is what mvn says:

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

What's wrong here?


回答1:


The error message is giving you the correct feedback here, you cannot specify a <build/> section in an external profile, you are only allowed to specify <properties>, <pluginRepositories>, and <repositories>. From the Introduction to Build Profiles:

Profiles in external files

Profiles specified in external files (i.e in settings.xml or profiles.xml) are not portable in the strictest sense. Anything that seems to stand a high chance of changing the result of the build is restricted to the inline profiles in the POM. Things like repository lists could simply be a proprietary repository of approved artifacts, and won't change the outcome of the build. Therefore, you will only be able to modify the <repositories> and <pluginRepositories> sections, plus an extra <properties> section.

The <properties> section allows you to specify free-form key-value pairs which will be included in the interpolation process for the POM. This allows you to specify a plugin configuration in the form of ${profile.provided.path}.

If your snippet is coming from a book, the book should be fixed.




回答2:


You can not have <build> area in your profile. Only plugins etc. You can configure the plugins etc.



来源:https://stackoverflow.com/questions/3351238/whats-wrong-with-my-profiles-xml

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!