Hi
I would like to add maven-artifact-ant-2.0.2-dep.jar as a dependency to an ant 
plugin.
I added the jar file to my local repository. But I only get a stack trace when 
I try to execute
the plugin.

I want to add maven-artifact-ant-2.0.2-dep as a dependency because I don't know 
how else I could achieve
the following with only the ant plugin:

<!-- This creates a fileset -->
<artifact:dependencies filesetId="dependency.fileset">
    <pom refid="maven.project"/>
</artifact:dependencies>

<!-- Here I can copy the dependencies from the repository to a folder -->
<copy todir="target/my-dependencies">
    <fileset refid="dependency.fileset"/>
</copy>

So if anybody knows how this could be done with a pure ant plugin or if anybody
knows how to add maven-artifact-ant-2.0.2-dep as a dependency... Any help would
be welcome.

Cheers, michael

C:\Dokumente und 
Einstellungen\mike\Desktop\tmp\my-app>c:\maven-2.0.2-bin\maven-2.0.2\bin\mvn -e 
org.myproject.plugins:hello-plugin:hello
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] 
----------------------------------------------------------------------------
[INFO] Building Hello Plugin
[INFO]    task-segment: [org.myproject.plugins:hello-plugin:hello] 
(aggregator-style)
[INFO] 
----------------------------------------------------------------------------
[INFO] 
----------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] 
----------------------------------------------------------------------------
[INFO] org.apache.maven.script.ant.AntMojoComponentFactory
[INFO] 
----------------------------------------------------------------------------
[INFO] Trace
java.lang.ClassCastException: 
org.apache.maven.script.ant.AntMojoComponentFactory
        at 
org.codehaus.plexus.component.factory.DefaultComponentFactoryManager.findComponentFactory(DefaultComponentFactoryManager.java:68)
        at 
org.codehaus.plexus.DefaultPlexusContainer.createComponentInstance(DefaultPlexusContainer.java:1457)
        at 
org.codehaus.plexus.component.manager.AbstractComponentManager.createComponentInstance(AbstractComponentManager.java:93)
        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:527)
        at 
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:393)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:531)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:485)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:455)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:303)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:216)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:139)
        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:249)
        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)
[INFO] 
----------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Sun Mar 26 17:19:10 CEST 2006
[INFO] Final Memory: 2M/5M
[INFO] 
----------------------------------------------------------------------------
<project>
  <modelVersion>4.0.0</modelVersion>
    
  <groupId>org.myproject.plugins</groupId>
  <artifactId>hello-plugin</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>maven-plugin</packaging>
  <name>Hello Plugin</name>
    
  <build>
    <plugins>
      <plugin>
        <!-- NOTE: We don't need groupId if the plugin's groupId is
             org.apache.maven.plugins OR org.codehaus.mojo.
             We also don't have to specify a version, since Maven can
             automatically resolve the newest one.
        -->
        <artifactId>maven-plugin-plugin</artifactId>
        
        <!-- Add the Ant plugin tools -->
        <dependencies>
          <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-tools-ant</artifactId>
            <version>2.0.1</version>
          </dependency>
        </dependencies>
        
        <!-- Tell the plugin-plugin which prefix we will use.
             Later, we'll configure Maven to allow us to invoke this
             plugin using the "prefix:mojo" shorthand.
        -->
        <configuration>
          <goalPrefix>hello</goalPrefix>
        </configuration>
      </plugin>
    </plugins>
  </build>
  
  <dependencies>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-script-ant</artifactId>
      <version>2.0.1</version>
    </dependency>
    <dependency>
      <groupId>maven-artifact-ant</groupId>
      <artifactId>maven-artifact-ant</artifactId>
      <version>2.0.2-dep</version>
      <scope>compile</scope> 
    </dependency>
  </dependencies>
</project>
<pluginMetadata>
  <mojos>
    <mojo>
      <goal>hello</goal>
        
      <!-- this element refers to the Ant target we'll invoke -->
      <call>hello</call>
      <description>
        Say Hello, World.
      </description>
    </mojo>
  </mojos>
</pluginMetadata>
<project>
  <target name="hello">
    <echo>Hello, World</echo>
  </target>
</project>

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

Reply via email to