You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Scott Ryan <sr...@gmail.com> on 2007/02/17 22:54:24 UTC

Accessing the POM classpath from within an Ant based mojo

I am trying to write a very simple Ant based script mojo.  I need to  
define some taskdefs from within the build.xml based on the current  
classpath defined in the plugin pom.  I have seen reference to using  
the maven.plugin.classpath but when I reference that I get an error  
that it is not present.  I also tried passing the path in as a  
parameter to the mojo but that did not work either.   The basic idea  
is that I have an Ant based mojo and I want to define a taskdef in my  
build.xml based on the classpath defined in the pom.xml of the plugin.

Any ideas or suggestions would be appreciated.


Scott Ryan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Accessing the POM classpath from within an Ant based mojo

Posted by Matt Brozowski <br...@opennms.org>.
On Feb 17, 2007, at 4:54 PM, Scott Ryan wrote:

> I am trying to write a very simple Ant based script mojo.  I need  
> to define some taskdefs from within the build.xml based on the  
> current classpath defined in the plugin pom.  I have seen reference  
> to using the maven.plugin.classpath but when I reference that I get  
> an error that it is not present.  I also tried passing the path in  
> as a parameter to the mojo but that did not work either.   The  
> basic idea is that I have an Ant based mojo and I want to define a  
> taskdef in my build.xml based on the classpath defined in the  
> pom.xml of the plugin.


I have managed to do this but it requires you to set things up  
manually in ant.  Here is a link to the one I did to run the groovy  
compiler task on my classes.

I was doing groovy so I used a scriptdef task written in groovy that  
sets up the classpaths before i runs the other tasks.

http://opennms.svn.sourceforge.net/viewvc/opennms/maven-plugins/trunk/ 
opennms-groovyc-plugin/src/main/scripts/

Matt
________________________________________________________________________ 
___
Matt Brozowski, OpenNMS Maintainer Main: +1 919 812 4984
The OpenNMS Group, Inc. Fax: +1 503 961 7746
Email: brozow@opennms.org URL: http://www.opennms.com



Re: Accessing the POM classpath from within an Ant based mojo

Posted by Scott Ryan <sr...@gmail.com>.
Thanks for the quick answer.   I am not not 2.0.5 yet but I assume  
you mean any version of 2.0.x will not work.  So that means there is  
no way to do a taskdef in an ant based mojo?  I could have sworn I  
had it working a few months ago.  Seems that an ant mojo is pretty  
hampered if I cannot define any taskdefs.  I guess I will have to see  
about using a Java mojo to front end the ant tasks and then use the  
java mojo facilities to create the task def.  I was hoping someone  
had come up with a cute trick to allow tasks defs in ant based mojos.

Too bad as it would have made it an easy task to implement the ant  
tasks I need and to front them with mojos for ease of configuration.


I will keep my fingers crossed for a solution soon but in the mean  
time I guess it is slog in the code again time.


Scott Ryan
On Feb 17, 2007, at 7:42 PM, Jason van Zyl wrote:

>
> On 17 Feb 07, at 4:54 PM 17 Feb 07, Scott Ryan wrote:
>
>> I am trying to write a very simple Ant based script mojo.  I need  
>> to define some taskdefs from within the build.xml based on the  
>> current classpath defined in the plugin pom.  I have seen  
>> reference to using the maven.plugin.classpath but when I reference  
>> that I get an error that it is not present.  I also tried passing  
>> the path in as a parameter to the mojo but that did not work  
>> either.   The basic idea is that I have an Ant based mojo and I  
>> want to define a taskdef in my build.xml based on the classpath  
>> defined in the pom.xml of the plugin.
>>
>> Any ideas or suggestions would be appreciated.
>>
>
> This will not work with 2.0.5. I have made changes to 2.1.x that  
> allow using file references and the classpath information (just  
> like the ant-run-plugin) but I currently have not merged it back to  
> 2.0.x.
>
> Jason.
>
>>
>> Scott Ryan
>>
>> ---------------------------------------------------------------------
>> 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


Re: Accessing the POM classpath from within an Ant based mojo

Posted by Jason van Zyl <ja...@maven.org>.
On 17 Feb 07, at 4:54 PM 17 Feb 07, Scott Ryan wrote:

> I am trying to write a very simple Ant based script mojo.  I need  
> to define some taskdefs from within the build.xml based on the  
> current classpath defined in the plugin pom.  I have seen reference  
> to using the maven.plugin.classpath but when I reference that I get  
> an error that it is not present.  I also tried passing the path in  
> as a parameter to the mojo but that did not work either.   The  
> basic idea is that I have an Ant based mojo and I want to define a  
> taskdef in my build.xml based on the classpath defined in the  
> pom.xml of the plugin.
>
> Any ideas or suggestions would be appreciated.
>

This will not work with 2.0.5. I have made changes to 2.1.x that  
allow using file references and the classpath information (just like  
the ant-run-plugin) but I currently have not merged it back to 2.0.x.

Jason.

>
> Scott Ryan
>
> ---------------------------------------------------------------------
> 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