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]


Reply via email to