我是 maven 的新手。我已经使用 ant 编写了构建脚本。我试图在 maven 中显示所有 evn 属性、用户定义的属性、系统属性等。在 Ant 中我可以做以下事情。
我尝试用 maven-antrun-plugin 对 maven 做同样的事情
但是得到如下错误。
Embedded error: Could not create task or type of type: echoproperties.
Ant could not find the task or a class this task relies upon.
我如何在使用或不使用 echoproperties 的情况下查看 Maven 中的所有属性。这是我在maven中的配置
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${maven.plugin.antrun.version}</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo>Displaying value of properties</echo>
<echo>[org.junit.version] ${org.junit.version}</echo>
<echoproperties prefix="org" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
最佳答案
我很适合 maven
2.2.1 和 3.0.1。运行片段...
[INFO] --- maven-antrun-plugin:1.6:run (default) @ myproject ---
[INFO] Executing tasks
main:
[echoproperties] #Ant properties
[echoproperties] #Sun Dec 26 20:08:02 IST 2010
[echoproperties] org.aspectj\:aspectjrt\:jar=D\:\\maven\\.m2\\repository\\org\\a
spectj\\aspectjrt\\1.6.8\\aspectjrt-1.6.8.jar
[echoproperties] org.aspectj\:aspectjweaver\:jar=D\:\\maven\\.m2\\repository\\or
g\\aspectj\\aspectjweaver\\1.6.8\\aspectjweaver-1.6.8.jar
...
哪个版本maven
你在使用(最新的是 3.0.1)吗? maven-antrun-plugin
是哪个版本(最新是1.6)?
最新版maven-antrun-plugin
对 <tasks>
给出弃用警告标签。 <target>
应该改用。
<configuration>
<target>
<echoproperties prefix="org" />
</target>
</configuration>
关于Maven ant echoproperties 任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4532687/