You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Prasad Kashyap <go...@gmail.com> on 2006/03/11 00:28:38 UTC
Re: {M2.0.2] refer maven.dependency.classpath in developing ant plugin (mojo)
Can I please have that anttask that you guys were talking about ? I
need to pass the ${project.compileClasspathElements} to a build.xml
file that I run from an ant-run plugin.
I want to convert that path and be able to use it for a javac ant task
inside the build.xml
Thanx in advance.
Prasad
On 2/27/06, hermod.opstvedt@dnbnor.no <he...@dnbnor.no> wrote:
> Hi
>
> Thanks a lot for the task (you mailadress bounced so i'm posting it here)
>
> -----Original Message-----
> From: hermod.opstvedt@dnbnor.no [mailto:hermod.opstvedt@dnbnor.no]
> Sent: Friday, February 24, 2006 12:45 PM
> To: users@maven.apache.org
> Subject: RE: {M2.0.2] refer maven.dependency.classpath in developing ant
> plugin (mojo)
>
>
> Hi
>
> Could you post the listtopath task, please.
>
>
> Hermod
>
> -----Original Message-----
> From: Bill Yang [mailto:byang@parlaygroup.com]
> Sent: Tuesday, February 21, 2006 4:08 PM
> To: Maven Users List
> Subject: RE: {M2.0.2] refer maven.dependency.classpath in developing ant
> plugin (mojo)
>
>
> Martin,
>
> Thanks, I will give a try.
>
> Bill
>
>
> -----Original Message-----
> From: mvdp [mailto:mvdp@imc.nl]
> Sent: Monday, February 20, 2006 5:02 PM
> To: Maven Users List
> Subject: RE: {M2.0.2] refer maven.dependency.classpath in developing ant
> plugin (mojo)
>
>
> Bill,
>
> My mojo is currently configured to use the element value
> ${project.testClasspathElements} as the mojo is with the test phase as in:
> <parameter>
> <name>classpath</name>
> <required>true</required>
> <readonly>true</readonly>
> <expression>${project.testClasspathElements}</expression>
> <description>classpath used by junit</description>
> <type>java.util.List</type>
> </parameter>
>
> Run mvn -DantMessageLevel=debug to find out the listtopath output (look for
> lines with the text "add path element").
>
> Martin
>
>
> -----Oorspronkelijk bericht-----
> Van: Bill Yang [mailto:byang@parlaygroup.com]
> Verzonden: maandag 20 februari 2006 22:18
> Aan: Maven Users List
> Onderwerp: RE: {M2.0.2] refer maven.dependency.classpath in developing
> ant plugin (mojo)
>
>
> Martin,
>
> Can you tell me what I will specify if I hope to get the path exactly as
> "maven.dependency.classpath"?
> I tried using couple of variables in MavenProject class, but unfortunately
> no working.
>
> Thanks.
>
> Bill
>
>
> -----Original Message-----
> From: mvdp [mailto:mvdp@imc.nl]
> Sent: Monday, February 20, 2006 4:11 PM
> To: Maven Users List
> Subject: RE: {M2.0.2] refer maven.dependency.classpath in developing ant
> plugin (mojo)
>
>
> Bill,
>
> The ${project.compileClasspathElements} value was a test setting.
> You can specify any value you like.
>
> Martin
>
>
> -----Oorspronkelijk bericht-----
> Van: Bill Yang [mailto:byang@parlaygroup.com]
> Verzonden: maandag 20 februari 2006 20:54
> Aan: Maven Users List
> Onderwerp: RE: {M2.0.2] refer maven.dependency.classpath in developing
> ant plugin (mojo)
>
>
> Martin,
>
> Thanks for the help.
>
> I tested your anttask, I found when I set the expression
> ${project.compileClasspathElements}, the returned path just contains
> ${basedir}\target\classes, but without including all dependencies. I checked
> antrun plugin, it is using the method getCompileClasspathElements() to get
> path, which includes all dependencies classpath. Is there anything wrong or
> missing with my setting?
>
> my Mojo is:
> <mojo>
> <goal>get-classpath</goal>
> <call>get-classpath</call>
> <description>get classpath</description>
> <parameter>
> <name>classpath</name>
> <required>true</required>
> <readonly>true</readonly>
> <expression>${project.compileClasspathElements}</expression>
> <description>classpath</description>
> </parameter>
> </mojo>
>
> my Ant script is:
>
> <target name="get-classpath">
> <echo>Try to get the classpath</echo>
> <taskdef resource="comtasks.properties"/>
> <listtopath sourceref="classpath" targetref="compile.classpath"/>
> <pathconvert property="echo.compile.classpath"
> refid="compile.classpath"/>
> <echo message="classpath=${echo.compile.classpath}"/>
> </target>
>
> Thanks.
>
> Bill
>
>
> -----Original Message-----
> From: Martin van der Plas [mailto:mvdp@imc.nl]
> Sent: Monday, February 20, 2006 10:16 AM
> To: Maven Users List
> Subject: Re: {M2.0.2] refer maven.dependency.classpath in developing ant
> plugin (mojo)
>
>
> Bill,
>
> I've sent the anttask code to your mail adress .
>
> Your mojo configuration looks ok (by eyeball inspection).
>
> The default expression of each parameter is ${name}.
> defaultValue will be used when expression evaluates to null.
> So as long as you don't configure ${name} on the mvn command line or in
> the plugin configuration, defaultValue is used.
> The parameter is marked readonly and required so I prefer to use
> expression to set is value.
> I don't want users to override this value to make the build reproduceable.
>
> Martin
>
> Bill Yang wrote:
>
> >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:mvdp@imc.nl]
> >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#a23422
> 9
> >>
> >>
> >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: users-unsubscribe@maven.apache.org
> >>For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
> >>
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> >
>
>
> --
> Groeten,
>
> Martin
>
> mailto:mvdp@imc.nl
> tel: +31 (0) 20-7988464
> mob: +31 (0) 6-21551921
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.375 / Virus Database: 267.15.11/264 - Release Date: 17-02-2006
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.375 / Virus Database: 267.15.11/264 - Release Date: 17-02-2006
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.375 / Virus Database: 267.15.11/264 - Release Date: 17-02-2006
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.375 / Virus Database: 267.15.11/264 - Release Date: 17-02-2006
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
>
> This email with attachments is solely for the use of the individual or
> entity to whom it is addressed. Please also be aware that the DnB NOR Group
> cannot accept any payment orders or other legally binding correspondence with
> customers as a part of an email.
>
> This email message has been virus checked by the virus programs used
> in the DnB NOR Group.
>
> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org