Martin,
Thanks a lot.
It will very appreciated if you can send your anttask me.
btw, you said, I need to define a path as a readonly parameter
of type java.util.List and set expression to ${maven.project.classpath},
is it "expression" tag, or "defaultValue" tag.
I guess the mojo should me like this,
<mojo>
<goal>get-classpath</goal>
<call>get-classpath</call>
<description>get classpath</description>
<parameters>
<parameter>
<name>dependencyclasspath</name>
<property>dependencyclasspath</property>
<required>true</required>
<readonly>true</readonly>
<defaultValue>${maven.project.classpath}</defaultValue>
<type>java.util.List</type>
<description>maven dependency
classpath.</description>
</parameter>
</parameters>
</mojo>
is that right?
Regards,
Bill
-----Original Message-----
From: Martin van der Plas [mailto:[EMAIL PROTECTED]
Sent: Monday, February 20, 2006 4:11 AM
To: Maven Users List
Subject: Re: {M2.0.2] refer maven.dependency.classpath in developing ant
plugin (mojo)
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#a234229
0
>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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]