Hi, the attached project produces the following error message: Could not create task or type of type: antlib:org.apache.maven.artifact.ant:pom.
It's a simple project. The project should only demonstrate my problem. It seems that maven-plugin-plugin can't find org.apache.... although maven-artifact-ant-2.0.x is on the classpath. If anybody could please take a look at it? Cheers, michael For building and running the attached project execute: mvn install mvn org.myproject.plugins:test-plugin:test File structure: TestPlugin |- pom.xml |- src |- main |- scripts |- test.build.xml |- test.mojos.xml
<project> <modelVersion>4.0.0</modelVersion> <groupId>org.myproject.plugins</groupId> <artifactId>test-plugin</artifactId> <version>1.0-SNAPSHOT</version> <packaging>maven-plugin</packaging> <name>Test 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>test</goalPrefix> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-artifact-ant</artifactId> <version>2.0.3</version> <scope>runtime</scope> </dependency> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-script-ant</artifactId> <version>2.0.1</version> <scope>runtime</scope> </dependency> </dependencies> </project>
<!-- <project name="test task" xmlns:artifact="urn:maven-artifact-ant"> <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant"> <classpath> <pathelement location="c:/maven-artifact-ant-2.0.3-dep.jar" /> </classpath> </typedef> --> <project name="test task" xmlns:artifact="antlib:org.apache.maven.artifact.ant"> <!-- Check that org.apache.maven.artifact.ant.Pom is on the classpath --> <target name="check.artifact.ant"> <available property="artifact.ant.installed" classname="org.apache.maven.artifact.ant.Pom"/> </target> <!-- Print error message if org.apache... is not on the classpath --> <target name="guard.noartifact" depends="check.artifact.ant" unless="artifact.ant.installed"> <fail message="Can't find maven.artifact.ant in the classpath."/> </target> <!-- Here we see, that org.apache.... is on the classpath but artifact:pom still produces an error --> <target name="test" depends="guard.noartifact"> <echo>Found org.apache.maven.artifact.ant.Pom on the classpath</echo> <artifact:pom id="maven" file="pom.xml" /> <!-- <property name="build.dir" value="${maven.build.directory}"/> --> </target> </project>
<pluginMetadata> <mojos> <mojo> <goal>test</goal> <!-- this element refers to the Ant target we'll invoke --> <call>test</call> <requiresProject>true</requiresProject> <description> Task that unfortunately fails. </description> </mojo> </mojos> </pluginMetadata>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]