Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
856 views
in Technique[技术] by (71.8m points)

maven ant echoproperties task

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 .

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

But get the following error.

Embedded error: Could not create task or type of type: echoproperties.
Ant could not find the task or a class this task relies upon.

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>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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
...

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

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...