Andrei Serea created MNG-6031:
---------------------------------
Summary: Moving from Maven 3.2.5 or older to Maven 3.3.1 or newer
breaks maven-antrun-plugin
Key: MNG-6031
URL: https://issues.apache.org/jira/browse/MNG-6031
Project: Maven
Issue Type: Bug
Components: Class Loading, core
Affects Versions: 3.3.9, 3.3.3
Environment: Windows 7, JDK 1.8.0_51
Reporter: Andrei Serea
Priority: Blocker
Running an ant file that requires SLF4J breaks with a NoClassDefFoundError.
The example attached calls the cobertura-merge ant task and the error is:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/slf4j/LoggerFactory
{code}
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Cobertura Merge test 1.12-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ cobertura-report ---
[INFO] Deleting C:\IBXProjects\SUE\git\discovery\src\java\cobertura\target
[INFO]
[INFO] --- maven-antrun-plugin:1.8:run (cobertura-merge-base) @
cobertura-report ---
[INFO] Executing tasks
main:
[cobertura-merge] Cobertura 2.1.1 - GNU GPL License (NO WARRANTY) - See
COPYRIGHT file
[cobertura-merge] Exception in thread "main" java.lang.NoClassDefFoundError:
org/slf4j/LoggerFactory
[cobertura-merge] at
net.sourceforge.cobertura.util.CommandLineBuilder.<clinit>(CommandLineBuilder.java:73)
[cobertura-merge] at
net.sourceforge.cobertura.merge.MergeMain.merge(MergeMain.java:66)
[cobertura-merge] at
net.sourceforge.cobertura.merge.MergeMain.main(MergeMain.java:77)
[cobertura-merge] Caused by: java.lang.ClassNotFoundException:
org.slf4j.LoggerFactory
[cobertura-merge] at
java.net.URLClassLoader.findClass(URLClassLoader.java:381)
[cobertura-merge] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[cobertura-merge] at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
[cobertura-merge] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[cobertura-merge] ... 3 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.265 s
[INFO] Finished at: 2016-05-31T18:59:31+03:00
[INFO] Final Memory: 9M/119M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-antrun-plugin:1.8:run (cobertura-merge-base) on
project cobertura-report: An Ant BuildException has occured: Error running
reports. See messages above.
[ERROR] around Ant part ...<cobertura-merge
datafile="C:\IBXProjects\SUE\git\discovery\src\java\cobertura\target/cobertura/cobertura.ser">...
@ 5:114 in
C:\IBXProjects\SUE\git\discovery\src\java\cobertura\target\antrun\build-main.xml
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please
read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
{code}
The pom used:
{code}
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<properties>
<cobertura.version>2.1.1</cobertura.version>
</properties>
<groupId>org.tests</groupId>
<artifactId>cobertura-report</artifactId>
<version>1.12-SNAPSHOT</version>
<name>Cobertura Merge test</name>
<packaging>pom</packaging>
<build>
<finalName>cobertura-report</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>net.sourceforge.cobertura</groupId>
<artifactId>cobertura</artifactId>
<version>${cobertura.version}</version>
</dependency>
</dependencies>
<executions>
<!-- restart the wildfly servers at the
beginning-->
<execution>
<id>cobertura-merge-base</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<taskdef
name="cobertura-merge" classname="net.sourceforge.cobertura.ant.MergeTask"
classpathref="maven.plugin.classpath"/>
<cobertura-merge datafile="${project.build.directory}/cobertura/cobertura.ser">
<fileset dir="${project.basedir}/../">
<include name="*.ser"/>
</fileset>
</cobertura-merge>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)