Bill,
See http://www.nabble.com/forum/ViewPost.jtp?post=2661163&framed=y.
The classpaths are not available to the ant project by default. You need
to define a path as a readonly parameter of type java.util.List and set
expression to e.g ${maven.project.testClasspath}.
Since the parameter is not a String, it is added to the projects as a
reference, with key name equal to the parameter name.
Then, you need an anttask to convert the list into a path.
I've the anttask code available, also sent it to John Casey but got no
reply yet. I can give you the code in case you are interested.
Martin
Bill Yang wrote:
Hello,
Thanks to the guide,
http://maven.apache.org/guides/plugin/guide-ant-plugin-development.html
I have successfully developed some simple ant plugin. but when I run an ant
script to refer the maven classpath, I got
[ERROR] BUILD ERROR
[INFO]
----------------------------------------------------------------------------
[INFO] Failed to execute: Executing Ant script: /test.build.xml
[get-classpath]: Failed to execute.
Reference maven.dependency.classpath not found..
even I tried use a parameter with
<defaultValue>${project.runtimeClasspathElements}</defaultValue>
<type>java.util.Set</type>
I am using maven 2.0.2, Here is the source:
test.build.xml
<project>
<target name="get-classpath">
<echo>Try to get the classpath</echo>
<property name="out" refid="maven.dependency.classpath" />
<echo>out: ${out}</echo>
</target>
</project>
test.mojo.xml
<mojo>
<goal>get-classpath</goal>
<call>get-classpath</call>
<description>get classpath</description>
</mojo>
in the plugin pom.xml, do have following configuration:
<artifactId>maven-plugin-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-tools-ant</artifactId>
<version>2.0.1</version>
</dependency>
</dependencies>
btw, from the link
http://www.nabble.com/Support-for-mojos-written-in-Ant-t863193.html#a2342290
seems we don't need to manually add any "maven.dependency.classpath" refids
to ANT,
that already happens behind the scenes. But why can't my ant script get
that reference?
Thanks in advance.
Bill
------------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]