我的profiles.xml有什么问题? [英] what's wrong with my profiles.xml?

查看:460
本文介绍了我的profiles.xml有什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我profiles.xmlmvn的一部分:

<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.xmlprofiles.xml)不可移植到 最严格的意义.任何东西 似乎很有可能 更改构建结果是 仅限于的内嵌配置文件 POM.诸如存储库列表之类的东西 可能只是专有的 批准文物的存储库,以及 不会改变构建的结果. 因此,您将只能 修改<repositories><pluginRepositories>部分,再加上 额外的<properties>部分.

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.

<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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆