[英]properties-maven-plugin not working for goal write-project-properties
我需要将属性值从mvn命令行导出到文件,该文件稍后将用于我的Java代码。 但是我总是得到错误:
[错误]无法在项目MyApplication上执行目标org.codehaus.mojo:properties-maven-plugin:1.0-alpha-2:write-project-properties(default-cli):目标org.codehaus的参数'outputFile'。 mojo:properties-maven-plugin:1.0-alpha-2:write-project-properties丢失或无效-> [帮助1] [错误]
这是我的项目结构
MyApplication
|src/main/java
|src/main/resources
|src/test/java
|src/test/resources
|lib ////(no files here yet)
|pom.xml
我的pom.xml是:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>write-project-properties</goal>
</goals>
<configuration><outputFile>${basedir}/lib/build.properties</outputFile>
</configuration>
</execution>
</executions>
</plugin>
注意:我尝试通过在lib文件夹中手动创建空文件build.properties甚至相同的错误来进行尝试。 也尝试使用插件版本1.0.0。
好了,经过数小时尝试pom.xml中的不同组合(moved <configuration> above/out of <executions>)
,现在我看到已创建lib / build.properties文件。 但是有人可以解释一下吗?
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<configuration>
<outputFile>${basedir}/lib/build.properties</outputFile>
</configuration>
<executions>
<execution>
<id>write-project-properties</id>
<goals>
<goal>write-project-properties</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
</plugin>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.