what's wrong with my profiles.xml?
This is a portion of my profiles.xml
for mvn
:
<profilesXml>
<profiles>
<profile>
<id>production</id>
&开发者_运维技巧lt;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?
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
orprofiles.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.
You can not have <build> area in your profile. Only plugins etc. You can configure the plugins etc.
精彩评论