Actually, I don't need the <classpath refid="maven.dependency.classpath"/> at
all. It works if I just omit it entirely.

I tried printing the various classpaths as in that post from Margaret
Martin. I get weird results for maven.dependency.classpath. Here it is with
just the default junit dependency listed:

     [echo] maven.dependency.classpath =
/home/pjungwir/src/ant-test/junit:/home/pjungwir/src/ant-test/jar:/home/pjungwir/src/ant-test/3.8.1:/home/pjungwir/src/ant-test/test

That can't be right. The other four maven.*.classpath refids come out
correct. I looked through MANTRUN on jira and didn't see a bug listed for
this. Is that the right project?

Thanks,
Paul




pjungwir wrote:
> 
> Thanks Dan, that got me what I need. The missing link in my mind was using
> maven.dependency.classpath to connect the plugin's deps to the <taskdef>.
> I never even thought about that, but I guess that's what it's there for!
> :-) Here is the final, working xml:
> 
>           <plugin>
>               <artifactId>maven-antrun-plugin</artifactId>
>               <executions>
>                   <execution>
>                       <id>copy-tree</id>
>                       <phase>initialize</phase>
>                       <goals><goal>run</goal></goals>
>                       <configuration>
>                           <tasks>
>                               <typedef
> resource="org/apache/maven/artifact/ant/antlib.xml">
>                                   <classpath
> refid="maven.dependency.classpath"/>
>                               </typedef>
>                               <delete dir="target"/>
>                               <pom id="maven.project" file="pom.xml"/>
>                               <dependencies
> filesetId="dependency.fileset">
>                                   <pom refid="maven.project"/>
>                               </dependencies>
>                               <mkdir dir="target/deps"/>
>                               <copy todir="target/deps">
>                                   <fileset refid="dependency.fileset"/>
>                               </copy>
>                           </tasks>
>                       </configuration>
>                   </execution>
>               </executions>
>               <dependencies>
>                   <dependency>
>                       <groupId>org.apache.maven</groupId>
>                       <artifactId>maven-artifact-ant</artifactId>
>                       <version>2.0.4</version>
>                   </dependency>
>               </dependencies>
>           </plugin>
> 
> Note there is no <classifier> on the dependency, and I did away with the
> artifact: namespace entirely.
> 
> Paul
> 
> 
> dan tran wrote:
>> 
>> see if this helps
>> 
>> http://www.nabble.com/M2-antrun-plugin-problem-tf1400135.html#a5892203
>> 
>> -D
>> 
>> 
>> On 10/25/06, pjungwir <[EMAIL PROTECTED]> wrote:
>>>
>>>
>>> Hello,
>>>
>>> This is kind of a weird question. Suppose I'm writing a <tasks> block
>>> for
>>> maven-antrun-plugin. Now suppose I want to use maven's ant-tasks there.
>>> For
>>> example (to borrow from another poster):
>>>
>>>                          <tasks>
>>>                              <delete dir="target"/>
>>>                              <artifact:pom id="maven.project"
>>> file="pom.xml"/>
>>>                              <artifact:dependencies
>>> filesetId="dependency.fileset">
>>>                                  <pom refid="maven.project"/>
>>>                              </artifact:dependencies>
>>>                              <mkdir dir="target/deps"/>
>>>                              <copy todir="target/deps">
>>>                                  <fileset refid="dependency.fileset"/>
>>>                              </copy>
>>>                          </tasks>
>>>
>>> I'm having trouble with two things. First, I need to include
>>> maven-artifact-ant-2.0.4-dep.jar in ant's classpath. I tried adding this
>>> to
>>> the beginning of <tasks>:
>>>
>>>                              <typedef
>>> resource="org/apache/maven/artifact/ant/antlib.xml"
>>> uri="urn:maven-artifact-ant">
>>>                                  <classpath>
>>>                                      <pathelement
>>> location="/home/pjungwir/maven-artifact-ant-2.0.4-dep.jar"/>
>>>                                  </classpath>
>>>                              </typedef>
>>>
>>> That didn't work. I also tried this inside my <plugin> tag (with and
>>> without
>>> the <classifier> element):
>>>
>>>              <dependencies>
>>>                  <dependency>
>>>                      <groupId>org.apache.maven</groupId>
>>>                      <artifactId>maven-artifact-ant</artifactId>
>>>                      <version>2.0.4</version>
>>>                      <classifier>dep</classifier>
>>>                  </dependency>
>>>              </dependencies>
>>>
>>> Without the <classifier>, I just get the regular ant error message about
>>> not
>>> recognizing artifact:pom. With <classifier>, I get this perplexing stack
>>> trace:
>>>
>>> java.lang.ClassCastException:
>>> org.codehaus.plexus.component.configurator.BasicComponentConfigurator
>>>        at
>>>
>>> org.codehaus.plexus.personality.plexus.lifecycle.phase.AutoConfigurePhase.execute
>>> (AutoConfigurePhase.java:34)
>>>        at
>>> org.codehaus.plexus.lifecycle.AbstractLifecycleHandler.start(
>>> AbstractLifecycleHandler.java:101)
>>>        at
>>>
>>> org.codehaus.plexus.component.manager.AbstractComponentManager.startComponentLifecycle
>>> (AbstractComponentManager.java:105)
>>>        at
>>>
>>> org.codehaus.plexus.component.manager.AbstractComponentManager.createComponentInstance
>>> (AbstractComponentManager.java:95)
>>>        at
>>>
>>> org.codehaus.plexus.component.manager.PerLookupComponentManager.getComponent
>>> (PerLookupComponentManager.java:48)
>>>        at
>>> org.codehaus.plexus.DefaultPlexusContainer.lookup(
>>> DefaultPlexusContainer.java:331)
>>>        at
>>> org.codehaus.plexus.DefaultPlexusContainer.lookup(
>>> DefaultPlexusContainer.java:440)
>>>        at
>>> org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(
>>> DefaultPluginManager.java:524)
>>>        at
>>> org.apache.maven.plugin.DefaultPluginManager.executeMojo(
>>> DefaultPluginManager.java:390)
>>>        at
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
>>> DefaultLifecycleExecutor.java:534)
>>>        at
>>>
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle
>>> (DefaultLifecycleExecutor.java:475)
>>>        at
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(
>>> DefaultLifecycleExecutor.java:454)
>>>        at
>>>
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
>>> (DefaultLifecycleExecutor.java:306)
>>>        at
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(
>>> DefaultLifecycleExecutor.java:273)
>>>        at
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(
>>> DefaultLifecycleExecutor.java:140)
>>>        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
>>>        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
>>>        at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
>>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>        at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java
>>> :39)
>>>        at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(
>>> DelegatingMethodAccessorImpl.java:25)
>>>        at java.lang.reflect.Method.invoke(Method.java:585)
>>>        at
>>> org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>>>        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>>>        at
>>> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>>>        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
>>>
>>> How do I get maven to include the ant-tasks jar in the classpath?
>>>
>>> Second, where do I put xmlns:artifact="urn:maven-artifact-ant"? Right
>>> now
>>> I'm putting it on maven's <project> tag, but perhaps it belongs on the
>>> <tasks> tag.
>>>
>>> Thanks,
>>> Paul
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Using-ant-tasks-inside-antrun-tf2508452.html#a6994761
>>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Using-ant-tasks-inside-antrun-tf2508452.html#a7000934
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to