我的profiles.xml有什么问题? [英] what's wrong with my profiles.xml?
问题描述
这是我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>
.从构建配置文件简介:
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:
外部文件中的配置文件
在外部文件中指定的配置文件 (即
settings.xml
或profiles.xml
)不可移植到 最严格的意义.任何东西 似乎很有可能 更改构建结果是 仅限于的内嵌配置文件 POM.诸如存储库列表之类的东西 可能只是专有的 批准文物的存储库,以及 不会改变构建的结果. 因此,您将只能 修改<repositories>
并<pluginRepositories>
部分,再加上 额外的<properties>
部分.
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.
<properties>
部分允许您
指定自由格式的键/值对
这将包含在
POM的插值过程.
这使您可以指定插件
配置形式
${profile.provided.path}
.
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.
这篇关于我的profiles.xml有什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!