Maven ant echoproperties任务 [英] maven ant echoproperties task

查看:77
本文介绍了Maven ant echoproperties任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Maven的新手.我已经使用ant编写了构建脚本.我试图在Maven中显示所有evn属性,用户定义的属性,系统属性等.在蚂蚁中,我可以做以下事情.

I am new to maven. I have written build scripts using ant. I am trying to display all the evn properties, user defined properties, system properties etc. in maven. In ant i could do the following .

我试图通过maven-antrun-plugin对maven进行同样的操作

I tried to do the same with maven with the maven-antrun-plugin

但是出现以下错误.

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中的配置

How can i see all properties in maven with or without using echoproperties. This is my configuration in 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对我来说很好用.跑步片段...

Works fine for me with maven 2.2.1 and 3.0.1. Snippet of the run...

[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)?

Which version of maven are you using (latest is 3.0.1)? Which version of maven-antrun-plugin (latest is 1.6)?

maven-antrun-plugin的最新版本为<tasks>标记提供了不建议使用的警告.应该使用<target>代替.

The latest version of maven-antrun-plugin gives a deprecated warning for <tasks> tag. <target> should be used instead.

<configuration>
    <target>
         <echoproperties prefix="org" />
     </target>
</configuration>

这篇关于Maven ant echoproperties任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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