这是profiles.xml
的mvn
的一部分:
<profilesXml>
<profiles>
<profile>
<id>production</id>
<build>
<plugins> .. </plugins>
</build>
</profile>
</profiles>
</profilesXml>
这是
mvn
所说的:Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException:
Unrecognised tag: 'build' (position: START_TAG seen ...</id>\n
<build>... @32:20)
怎么了
最佳答案
错误消息为您提供了正确的反馈,您不能在外部配置文件中指定<build/>
部分,而只能指定<properties>
,<pluginRepositories>
和<repositories>
。从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}
.
如果您的摘录来自一本书,则该书应该是固定的。
关于maven-2 - 我的profiles.xml有什么问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3351238/