maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Quentin Ng (JIRA)" <>
Subject [jira] Created: (MNG-5109) Passing Maven classpath to a ant mojo not working
Date Wed, 01 Jun 2011 05:27:24 GMT
Passing Maven classpath to a ant mojo not working

                 Key: MNG-5109
             Project: Maven 2 & 3
          Issue Type: Bug
          Components: Class Loading
         Environment: Apache Maven 3.0.3 (r1075438; 2011-03-01 04:31:09+1100)
Maven home: /usr/share/maven3
Java version: 1.6.0_24, vendor: Sun Microsystems Inc.
Java home: /usr/lib/jvm/java-6-sun-
Default locale: en_AU, platform encoding: UTF-8
OS name: "linux", version: "2.6.35-28-generic", arch: "amd64", family: "unix"
            Reporter: Quentin Ng
         Attachments: qng-maven3.tar

I use a ant tast called listtopath 
This is part of:

This task is to get around the headache of trying to get ${maven.compile.classpath} to be
passed from maven to the ant mojo.
It has worked like a treat in Maven 2 (I've included the maven 2 example)
but trying to run on maven 3 the CP isn't being passed through.

Basically this is what I do:
I have a simple mojo that takes a reference to the maven project.
It then uses the listtopath task to convert it into a refid that can be used.

The mojo.
the parameter to pass the maven project
<!--- rest ommitted --//>
                    <description>This is the pom for the project. Property is
                        read-only (i.e you can not set it)

<!--- rest ommitted --//>

Then in my maven-ant build

<project xmlns:artifact="antlib:org.apache.maven.artifact.ant">
    <property environment="env" value=""/>
<!-- make reference to the listtopath -->
    <taskdef name="listtopath" classname="org.codehaus.mojo.wasanttasks.ListToPathTask">

    <target name="ejb-stub-compile" depends="init-windows,init-unix">
        <echo>Starting ejb stub compilation</echo>

        <!-- using the maven project get the classpath -->
        <listtopath targetRef="classpath" mavenproject="mavenproject"/>
        <!-- convert it into a path and store in ref -->
        <pathconvert property="converted.compile.classpath" refid="classpath" dirsep="/"/>

        <!-- if the classpath works it should appear here -->

After compiling this I make a local-repository reference and call it

the call in the pom.

                    <mavenproject implementation="org.apache.maven.project.MavenProject">${project}</mavenproject>


The above worked with maven2 - migrating to Maven3 has caused the listtopath to stop working.
Alternatively there has to be an easier way to pass the cp through to ant!!!!

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:


View raw message