properties-maven-plugin:加载属性文件时出错 [英] properties-maven-plugin: Error loading properties-file
问题描述
我想将pom.xml中的所有属性提取到属性文件中.这些是常用属性,例如依赖项版本,插件版本和目录. 我正在使用properties-maven-plugin,但是它无法按我想要的方式工作.
I want to extract all the properties from my pom.xml into a properties-file. These are the common properties like dependency-versions, plugin-versions and directories. I'm using the properties-maven-plugin, but its not working as i want it to.
我的pom.xml的必要部分:
The essential part of my pom.xml:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-1</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${basedir}/pom.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
现在,当我运行"mvn properties:read-project-properties"时,出现以下错误:
Now when i run "mvn properties:read-project-properties" i get the following error:
[INFO] One or more required plugin parameters are invalid/missing for 'properties:read-project-properties'
[0] Inside the definition for plugin 'properties-maven-plugin' specify the following:
<configuration>
...
<files>VALUE</files>
</configuration>.
pom.properties文件位于与pom.xml相同的目录中. 我该怎么做才能让properties-maven-plugin读取我的properties-file?
The pom.properties-file is located in the same dir as the pom.xml. What can i do to let the properties-maven-plugin read my properties-file?
编辑
我在 http://jira.codehaus.org/browse/MOJO-1523上提出了一个问题. 它已被关闭为不是bug",原因是:
I filed an issue at http://jira.codehaus.org/browse/MOJO-1523. It has been closed as "not a bug", the reason is:
这是设计使然.项目定义 必须是独立的,否则 如果被引用,则不再完整 从其他地方作为 传递性部门.
It's by design. The project definition has to be self-contained, otherwise it is no longer complete if it is refered from elsewhere as part of the transitive deps.
推荐答案
EDIT2
请参见这里,了解使用Ant Tasks的变通方法,这使该用例成为可能
See here for a workaround using Ant Tasks, which makes this use case possible
这篇关于properties-maven-plugin:加载属性文件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!