[ http://jira.codehaus.org/browse/MANTRUN-59?page=comments#action_75471 ] 
            
Zarar Siddiqi commented on MANTRUN-59:
--------------------------------------

I'm having the exact same issue.

There needs to be a way to "convert" the maven classpath into one readable by 
the ant fragment.  If there is a suggested workaround or a better way to do 
this, I'd like to hear it.

Here is an example of this issue.  In the xdoclet task that I'm about to run, I 
need a dependency on velocity and velocity is declared in the pom.xml like this:

    <dependency>
      <groupId>velocity</groupId>
      <artifactId>velocity</artifactId>
      <version>1.4</version>
    </dependency> 

This is automatically added to the maven classpath maven.compile.classpath.

But if I use the taskdef like the following, it will fail 
(java.lang.NoClassDefFoundError)

   <taskdef
        name="xdoclet"
        classname="xdoclet.DocletTask">
        <classpath>
            <path refid="maven.compile.classpath"/>
        </classpath>
    </taskdef>

Even if I enter a hardcoded path, it will not work.

   <taskdef
        name="xdoclet"
        classname="xdoclet.DocletTask">
        <classpath>
            <pathelement location="C:/Documents and 
Settings/zarar/.m2/repository/velocity/velocity/1.4/velocity-1.4.jar"/>
        </classpath>
    </taskdef>


> Taskdef/Typedef and Plugin dependencies
> ---------------------------------------
>
>                 Key: MANTRUN-59
>                 URL: http://jira.codehaus.org/browse/MANTRUN-59
>             Project: Maven 2.x Antrun Plugin
>          Issue Type: Bug
>    Affects Versions: 1.1
>            Reporter: ttest
>
> I'm trying to run an ant task during a Maven run. The classes for that Ant 
> task are included in my Maven runtime dependencies(maven.runtime.classpath).
> Here the relevant snippet from my POM:
> <tasks>
>       <path id="my.maven.runtime.classpath">
>               <path refid="maven.runtime.classpath"/>
>       </path>
>       
>       <taskdef name="mostGenerator" 
> classname="com.bmw.most.generator.AntTask" 
> classpathref="maven.runtime.classpath"/>
>       
>       <mostGenerator configurationFile="mostGenerator.configuration" 
> targetDirectory="target/generated-sources/most"/>
> </tasks>
> This works if I don't provide depedencies in the POM for my plugin. But if I 
> do provide depedencies it doesn't work. I consider this to be a bug since 
> that should have no effect on the behaviour of "maven.runtime.classpath". My 
> first guess is that this is a classloading issue. Probably by providing 
> dependencies the classloaders get messed up and that causes the taskdef to 
> not load the classes from maven.runtime.classpath because echoing the value 
> of maven.runtime.classpath still gives the right classpath.
> I have tried all variants of dereferencing maven.runtime.classpath. Didn't 
> work.
> Also which is very interesting if I hardcode the classpath in the taskdef to 
> absolute pathnames it also does not work.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to