I am trying to generate code coverage reports using cobertura plugin.
I have this dependency in my pom.xml
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>cobertura</goal>
</goals>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
</configuration>
</execution>
</executions>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
</configuration>
When I build my project using this goal -U -B clean install cobertura:cobertura, i get the below error on my jenkins CI
16:37:31 [ERROR] Failed to execute goal org.codehaus.mojo:cobertura-maven-plugin:2.6:instrument (default-cli) on project TestModule: Unable to execute Cobertura. Error while executing process. Cannot run program "/bin/sh": error=7, Argument list too long -> [Help 1]
16:37:31 org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:cobertura-maven-plugin:2.6:instrument (default-cli) on project TestModule: Unable to execute Cobertura.
16:37:31 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
16:37:31 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
16:37:31 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
16:37:31 at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions(MojoExecutor.java:364)
16:37:31 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:198)
16:37:31 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
16:37:31 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
16:37:31 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
16:37:31 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
16:37:31 at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
16:37:31 at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
16:37:31 at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
16:37:31 at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
16:37:31 at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
16:37:31 at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
16:37:31 at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
16:37:31 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
16:37:31 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:76)
16:37:31 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
16:37:31 at java.lang.reflect.Method.invoke(Method.java:602)
16:37:31 at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
16:37:31 at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
16:37:31 at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
16:37:31 at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
16:37:31 Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to execute Cobertura.
16:37:31 at org.codehaus.mojo.cobertura.tasks.AbstractTask.executeJava(AbstractTask.java:244)
16:37:31 at org.codehaus.mojo.cobertura.tasks.InstrumentTask.execute(InstrumentTask.java:139)
16:37:31 at org.codehaus.mojo.cobertura.CoberturaInstrumentMojo.execute(CoberturaInstrumentMojo.java:162)
16:37:31 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
16:37:31 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
16:37:31 ... 23 more
16:37:31 Caused by: org.codehaus.plexus.util.cli.CommandLineException: Error while executing process.
16:37:31 at org.codehaus.plexus.util.cli.Commandline.execute(Commandline.java:656)
16:37:31 at org.codehaus.plexus.util.cli.CommandLineUtils.executeCommandLine(CommandLineUtils.java:144)
16:37:31 at org.codehaus.plexus.util.cli.CommandLineUtils.executeCommandLine(CommandLineUtils.java:107)
16:37:31 at org.codehaus.mojo.cobertura.tasks.AbstractTask.executeJava(AbstractTask.java:240)
16:37:31 ... 27 more
16:37:31 Caused by: java.io.IOException: Cannot run program "/bin/sh": error=7, Argument list too long
16:37:31 at java.lang.ProcessBuilder.start(ProcessBuilder.java:1042)
16:37:31 at java.lang.Runtime.exec(Runtime.java:615)
16:37:31 at java.lang.Runtime.exec(Runtime.java:526)
16:37:31 at org.codehaus.plexus.util.cli.Commandline.execute(Commandline.java:636)
16:37:31 ... 30 more
16:37:31 Caused by: java.io.IOException: error=7, Argument list too long
16:37:31 at java.lang.UNIXProcess.<init>(UNIXProcess.java:139)
16:37:31 at java.lang.ProcessImpl.start(ProcessImpl.java:152)
16:37:31 at java.lang.ProcessBuilder.start(ProcessBuilder.java:1023)
16:37:31 ... 33 more
The build is successful on my windows machine but fails on jenkins. When I downgrade cobertura version to 2.5.1 this error goes away but I get some parse exceptions since the parser for cobertura for 2.5.1 is not up to date with java syntax.
Can someone help me get this working for 2.6.0 versions and higher for cobertura