【问题标题】:maven ant echoproperties taskmaven ant echoproperties 任务
【发布时间】:2010-12-26 03:55:08
【问题描述】:

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

我尝试使用 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


    【解决方案1】:

    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&lt;tasks&gt; 标记给出了已弃用的警告。 &lt;target&gt; 应改为使用。

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

    【讨论】:

    • 谢谢,当我执行 mvn install 时它可以工作,但当我执行 mvn validate 时它不起作用。任何原因
    • 可能是因为默认阶段是安装,但不是验证。将阶段定义元素 validate 添加到执行元素
    猜你喜欢
    • 2013-06-19
    • 2011-03-31
    • 2012-10-25
    • 1970-01-01
    • 2011-02-07
    • 1970-01-01
    • 2016-09-16
    • 2011-03-20
    • 2010-11-18
    相关资源
    最近更新 更多