maven-2 - 我的profiles.xml有什么问题?

标签 maven-2

这是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>。从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}.



如果您的摘录来自一本书,则该书应该是固定的。

关于maven-2 - 我的profiles.xml有什么问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3351238/

相关文章:

maven-2 - 使用maven和嵌入式jetty : ClassCastException

maven-2 - 构建时的代码格式化

Java:如何构建基于 Maven 的项目的独立发行版?

java - 如何使用 Maven 构建 SWT 应用程序

java - 排除公共(public)项目的依赖

maven-2 - 仅当设置了属性时才在 Maven 中运行 Ant 任务

java - Netbeans "default config"用于 Maven 项目

maven-2 - 从存储库获取 Maven 模块而不是相对文件路径

java - 查看实际的 Maven 调用

maven-2 - 如何在 Maven/Surefire 单元测试运行 "mvn test"期间使 list 可用?