maven-antrun-plugin not forward compatible with maven 3.
--------------------------------------------------------
Key: MANTRUN-173
URL: https://jira.codehaus.org/browse/MANTRUN-173
Project: Maven 2.x Antrun Plugin
Issue Type: Bug
Affects Versions: 1.7
Environment: Windows 7, Maven 3, Java 1.6
Reporter: Peter Sherwood
Priority: Critical
Attachments: mavenerror.txt
In some environments we do not have a Nexus style repository and so to make an
out of the box build cycle we use antrun to install a jar into a local
repository. This works absolutely fine with no exceptions in Maven 2.2.1 in the
same environment mentioned above. Moving directly to Maven 3 the build does not
work and records the following exception:
Caused by: java.lang.NoSuchMethodError:
org/apache/maven/settings/RuntimeInfo.<init>(Lorg/apache/maven/settings/Settings;)V
at
org.apache.maven.artifact.ant.AbstractArtifactTask.readSettings(AbstractArtifactTask.java:382)
at
org.apache.maven.artifact.ant.AbstractArtifactTask.loadSettings(AbstractArtifactTask.java:311)
at
org.apache.maven.artifact.ant.AbstractArtifactTask.initSettings(AbstractArtifactTask.java:278)
at
org.apache.maven.artifact.ant.AbstractArtifactTask.getSettings(AbstractArtifactTask.java:223)
at
org.apache.maven.artifact.ant.AbstractArtifactTask.getDefaultLocalRepository(AbstractArtifactTask.java:212)
at
org.apache.maven.artifact.ant.AbstractArtifactTask.getLocalRepository(AbstractArtifactTask.java:700)
at
org.apache.maven.artifact.ant.AbstractArtifactTask.createLocalArtifactRepository(AbstractArtifactTask.java:110)
at org.apache.maven.artifact.ant.Pom.getMavenProject(Pom.java:272)
at org.apache.maven.artifact.ant.Pom.setVersion(Pom.java:570)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at
org.apache.tools.ant.IntrospectionHelper$AttributeSetter.setObject(IntrospectionHelper.java:1498)
at
org.apache.tools.ant.IntrospectionHelper.setAttribute(IntrospectionHelper.java:405)
... 38 more
My POM is as follows and has been cut down to show the problem only.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<modelVersion>4.0.0</modelVersion>
<groupId>MavenAntTest</groupId>
<artifactId>MavenAntTest</artifactId>
<version>1.0</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>initialize</phase>
<configuration>
<target
xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<path id="maven-ant-tasks.classpath"
path="${settings.localRepository}${file.separator}org${file.separator}apache${file.separator}maven${file.separator}maven-ant-tasks${file.separator}2.1.3${file.separator}maven-ant-tasks-2.1.3.jar"
/>
<typedef
resource="org/apache/maven/artifact/ant/antlib.xml"
uri="antlib:org.apache.maven.artifact.ant"
classpathref="maven-ant-tasks.classpath" />
<taskdef
resource="net/sf/antcontrib/antcontrib.properties"
classpathref="maven.plugin.classpath"
/>
<artifact:pom id="saxonInstall"
groupId="net.sf.saxon" artifactId="saxon"
version="9.3.0.5" name="Saxon
XSLT Parser">
</artifact:pom>
<if>
<available
file="${settings.localRepository}${file.separator}net${file.separator}sf${file.separator}saxon${file.separator}saxon${file.separator}9.3.0.5${file.separator}saxon-9.3.0.5.jar"
type="file" />
<then>
<echo message="Saxon jar already
copied"/>
</then>
<else>
<mkdir
dir="${settings.localRepository}${file.separator}net${file.separator}sf${file.separator}saxon${file.separator}saxon${file.separator}9.3.0.5"/>
<artifact:writepom
pomRefId="saxonInstall"
file="${settings.localRepository}${file.separator}net${file.separator}sf${file.separator}saxon${file.separator}saxon${file.separator}9.3.0.5${file.separator}saxon-9.3.0.5.pom"
/>
<artifact:pom id="netpom"
file="${settings.localRepository}${file.separator}net${file.separator}sf${file.separator}saxon${file.separator}saxon${file.separator}9.3.0.5${file.separator}saxon-9.3.0.5.pom"
/>
<artifact:install
file="${project.basedir}/src/main/resources/saxon-9.3.0.5.jar"
pomRefId="netpom"/>
</else>
</if>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>20020829</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
I attach the full maven output that shows the full problem report.
I also attach the working maven 2 output.
Please investigate for me.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira