Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-9757

Cobertura plugin fails maven builds unless workspace is whiped

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • cobertura-plugin
    • None
    • Solaris 10, Apache Tomcat Version 6.0.29, jdk1.6.0_21, Jenkins 1.409, Jenkins Cobertura Plugin 1.2, Maven 3, Maven Cobertura 2.5

      The Jenkins Cobertura plugin will always fail a Maven build if the workspace is not whiped out prior to the build taking place. Ant builds do not seem to have this behavior. In my Jenkins server, I have both Ant and Maven builds that use the Cobertura Jenkins plugin. The Ant builds work fine every time. The maven builds will ALWAYS fail from the Cobertura plugin if the workspace is not wiped out prior to the maven build running. The Cobertura Maven plugin DOES successfully create a report. Yet the Jenkins Cobertura plugin always thinks the build has failed if the workspace has not been wiped, and then fails to publish the report. See below Maven output (sanitized):
      Started by an SCM change
      Updating XXX
      U pom.xml
      At revision 73
      Found mavenVersion 3.0.2 from file jar:file:/buildtools/hudson/tools/maven-3.0.2/lib/maven-core-3.0.2.jar!/META-INF/maven/org.apache.maven/maven-core/pom.properties
      Parsing POMs
      [workspace] $ /buildtools/binaries/jdk1.6.0_21/bin/java -cp /buildtools/hudson/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.1.jar:/buildtools/hudson/tools/maven-3.0.2/boot/plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main /buildtools/hudson/tools/maven-3.0.2 /buildtools/tomcat/webapps/hudson/WEB-INF/lib/remoting-1.409.jar /buildtools/hudson/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.1.jar 64028
      <===[HUDSON REMOTING CAPACITY]===>channel started
      Executing Maven: -B -f /buildtools/hudson/jobs/XXX/workspace/pom.xml package
      [INFO] Scanning for projects...
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building XXX 2.11.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO]
      [INFO] — maven-resources-plugin:2.4.3:resources (default-resources) @ XXX —
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Copying 0 resource
      [INFO]
      [INFO] — maven-compiler-plugin:2.3.2:compile (default-compile) @ XXX —
      [INFO] Nothing to compile - all classes are up to date
      [INFO]
      [INFO] — maven-resources-plugin:2.4.3:testResources (default-testResources) @ XXX —
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Copying 0 resource
      [INFO]
      [INFO] — maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ XXX —
      [INFO] Nothing to compile - all classes are up to date
      [INFO]
      [INFO] — maven-surefire-plugin:2.7.1:test (default-test) @ XXX —
      [INFO] Surefire report directory: /buildtools/hudson/jobs/XXX/workspace/target/surefire-reports

      -------------------------------------------------------
      T E S T S
      -------------------------------------------------------
      There are no tests to run.

      Results :

      Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

      [JENKINS] Recording test results
      [INFO]
      [INFO] — maven-jar-plugin:2.3.1:jar (default-jar) @ XXX —
      [INFO] Building jar: /buildtools/hudson/jobs/XXX/workspace/target/XXX-2.11.0-SNAPSHOT.jar
      mojo forkStarted org.codehaus.mojo:cobertura-maven-plugin:2.5(default)
      [JENKINS] cobertura-maven-plugin already configured with xml reports enabled
      forkedProjectStarted XXX2.11.0-SNAPSHOT
      [INFO]
      [INFO] — maven-resources-plugin:2.4.3:resources (default-resources) @ XXX —
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Copying 0 resource
      [INFO]
      [INFO] — maven-compiler-plugin:2.3.2:compile (default-compile) @ XXX —
      [INFO] Nothing to compile - all classes are up to date
      [INFO]
      [INFO] — cobertura-maven-plugin:2.5:instrument (default) @ XXX —
      [INFO] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
      Cobertura: Loaded information on 61 classes.
      Instrumenting 4 files to /buildtools/hudson/jobs/XXX/workspace/target/generated-classes/cobertura
      Cobertura: Saved information on 61 classes.
      Instrument time: 2185ms

      [INFO] Instrumentation was successful.
      [INFO] NOT adding cobertura ser file to attached artifacts list.
      [INFO]
      [INFO] — maven-resources-plugin:2.4.3:testResources (default-testResources) @ XXX —
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Copying 0 resource
      [INFO]
      [INFO] — maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ XXX —
      [INFO] Nothing to compile - all classes are up to date
      [INFO]
      [INFO] — maven-surefire-plugin:2.7.1:test (default-test) @ XXX —
      [INFO] Surefire report directory: /buildtools/hudson/jobs/XXX/workspace/target/surefire-reports

      -------------------------------------------------------
      T E S T S
      -------------------------------------------------------
      There are no tests to run.

      Results :

      Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

      [JENKINS] Recording test results
      forkedProjectSucceeded XXX2.11.0-SNAPSHOT
      [JENKINS] Archiving /buildtools/hudson/jobs/XXX/workspace/pom.xml to /buildtools/hudson/jobs/XXX/modules/XXX$XXX/builds/2011-05-24_13-05-37/archive/XXX/XXX/2.11.0-SNAPSHOT/XXX-2.11.0-SNAPSHOT.pom
      mojo forkSucceeded org.codehaus.mojo:cobertura-maven-plugin:2.5(default)
      [JENKINS] Recording coverage results
      [JENKINS] cobertura-maven-plugin already configured with xml reports enabled
      [INFO]
      [INFO] — cobertura-maven-plugin:2.5:cobertura (default) @ XXX —
      [INFO] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
      Cobertura: Loaded information on 61 classes.
      Report time: 8726ms

      [INFO] Cobertura Report generation was successful.
      [JENKINS] Recording coverage results
      [JENKINS] Unable to add link to cobertura results
      projectSucceeded com.cccis.valuation.mvi.core:XXX:2.11.0-SNAPSHOT
      [JENKINS] Archiving /buildtools/hudson/jobs/XXX/workspace/target/XXX-2.11.0-SNAPSHOT.jar to /buildtools/hudson/jobs/XXX/modules/XXX$XXX/builds/2011-05-24_13-05-37/archive/XXX/XXX/2.11.0-SNAPSHOT/XXX-2.11.0-SNAPSHOT.jar
      sessionEnded
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 29.540s
      [INFO] Finished at: Tue May 24 13:06:14 CDT 2011
      [INFO] Final Memory: 11M/164M
      [INFO] ------------------------------------------------------------------------
      Sending e-mails to: XXX
      channel stopped
      Skipping Cobertura coverage report as build was not UNSTABLE or better ...
      Sending e-mails to: XXX
      Finished: SUCCESS

      Below is the Maven pom.xml (sanitized):
      <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">
      <modelVersion>4.0.0</modelVersion>
      <groupId>XXX</groupId>
      <artifactId>XXX</artifactId>
      <version>2.11.0-SNAPSHOT</version>
      <packaging>jar</packaging>
      <name>XXX</name>
      <description>XXX</description>
      <properties>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      </properties>
      <build>
      <plugins>
      <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>cobertura-maven-plugin</artifactId>
      <version>2.5</version>
      <configuration>
      <encoding>UTF-8</encoding>
      <formats>
      <format>xml</format>
      </formats>
      <instrumentation>
      <ignores>
      <ignore>XXX.*</ignore>
      </ignores>
      <excludes>
      <exclude>XXX/*.class</exclude>
      </excludes>
      </instrumentation>
      <check>
      <haltOnFailure>false</haltOnFailure>
      <branchRate>0</branchRate>
      <lineRate>0</lineRate>
      <totalBranchRate>0</totalBranchRate>
      <totalLineRate>0</totalLineRate>
      <packageLineRate>0</packageLineRate>
      <packageBranchRate>0</packageBranchRate>
      <regexes>
      <regex>
      <pattern>XXX.*</pattern>
      <branchRate>0</branchRate>
      <lineRate>0</lineRate>
      </regex>
      </regexes>
      </check>
      </configuration>
      <executions>
      <execution>
      <phase>package</phase>
      <goals>
      <goal>cobertura</goal>
      </goals>
      </execution>
      </executions>
      </plugin>
      </plugins>
      </build>
      <dependencies>
      <dependency>
      <groupId>com.oracle.jars.webservices.lib</groupId>
      <artifactId>jaxrpc-api</artifactId>
      <version>10.1.3.5</version>
      <type>jar</type>
      <scope>compile</scope>
      </dependency>
      <dependency>
      <groupId>com.oracle.jars.webservices.lib</groupId>
      <artifactId>wsclient</artifactId>
      <version>10.1.3.5</version>
      <type>jar</type>
      <scope>compile</scope>
      </dependency>
      <dependency>
      <groupId>com.oracle.jars.webservices.lib</groupId>
      <artifactId>soap</artifactId>
      <version>11.1.1.3.0</version>
      <type>jar</type>
      <scope>compile</scope>
      </dependency>
      <dependency>
      <groupId>XXX</groupId>
      <artifactId>XXX</artifactId>
      <version>2.11.0-SNAPSHOT</version>
      <scope>compile</scope>
      </dependency>
      </dependencies>
      <distributionManagement>
      <repository>
      <id>releases</id>
      <name>Releases</name>
      <url>http://XXX/content/repositories/releases/</url>
      </repository>
      <snapshotRepository>
      <id>snapshots</id>
      <name>Snapshots</name>
      <url>http://XXX/content/repositories/snapshots/</url>
      </snapshotRepository>
      </distributionManagement>
      </project>

      If the workspace is wiped out prior to the build, I get the following output (sanitized):
      Started by user XXX
      Updating http://XXX
      At revision 64
      no change for http://XXX
      Found mavenVersion 3.0.2 from file jar:file:/buildtools/hudson/tools/maven-3.0.2/lib/maven-core-3.0.2.jar!/META-INF/maven/org.apache.maven/maven-core/pom.properties
      Parsing POMs
      [workspace] $ /buildtools/binaries/jdk1.6.0_21/bin/java -cp /buildtools/hudson/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.1.jar:/buildtools/hudson/tools/maven-3.0.2/boot/plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main /buildtools/hudson/tools/maven-3.0.2 /buildtools/tomcat/webapps/hudson/WEB-INF/lib/remoting-1.409.jar /buildtools/hudson/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.1.jar 49846
      <===[HUDSON REMOTING CAPACITY]===>channel started
      Executing Maven: -B -f /buildtools/hudson/jobs/XXX/workspace/pom.xml package
      [INFO] Scanning for projects...
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building XXX 2.11.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO]
      [INFO] — maven-resources-plugin:2.4.3:resources (default-resources) @ XXX —
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Copying 0 resource
      [INFO]
      [INFO] — maven-compiler-plugin:2.3.2:compile (default-compile) @ XXX —
      [INFO] Compiling 61 source files to /buildtools/hudson/jobs/XXX/workspace/target/classes
      [INFO]
      [INFO] — maven-resources-plugin:2.4.3:testResources (default-testResources) @ XXX —
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Copying 0 resource
      [INFO]
      [INFO] — maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ XXX —
      [INFO] Nothing to compile - all classes are up to date
      [INFO]
      [INFO] — maven-surefire-plugin:2.7.1:test (default-test) @ XXX —
      [INFO] Surefire report directory: /buildtools/hudson/jobs/XXX/workspace/target/surefire-reports

      -------------------------------------------------------
      T E S T S
      -------------------------------------------------------
      There are no tests to run.

      Results :

      Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

      [JENKINS] Recording test results
      [INFO]
      [INFO] — maven-jar-plugin:2.3.1:jar (default-jar) @ XXX —
      [INFO] Building jar: /buildtools/hudson/jobs/XXX/workspace/target/XXX-2.11.0-SNAPSHOT.jar
      mojo forkStarted org.codehaus.mojo:cobertura-maven-plugin:2.5(default)
      [JENKINS] cobertura-maven-plugin already configured with xml reports enabled
      forkedProjectStarted XXX:XXX.11.0-SNAPSHOT
      [INFO]
      [INFO] — maven-resources-plugin:2.4.3:resources (default-resources) @ XXX —
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Copying 0 resource
      [INFO]
      [INFO] — maven-compiler-plugin:2.3.2:compile (default-compile) @ XXX —
      [INFO] Nothing to compile - all classes are up to date
      [INFO]
      [INFO] — cobertura-maven-plugin:2.5:instrument (default) @ XXX —
      [INFO] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
      Instrumenting 61 files to /buildtools/hudson/jobs/XXX/workspace/target/generated-classes/cobertura
      Cobertura: Saved information on 61 classes.
      Instrument time: 3242ms

      [INFO] Instrumentation was successful.
      [INFO] NOT adding cobertura ser file to attached artifacts list.
      [INFO]
      [INFO] — maven-resources-plugin:2.4.3:testResources (default-testResources) @ XXX —
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Copying 0 resource
      [INFO]
      [INFO] — maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ XXX —
      [INFO] Nothing to compile - all classes are up to date
      [INFO]
      [INFO] — maven-surefire-plugin:2.7.1:test (default-test) @ XXX —
      [INFO] Surefire report directory: /buildtools/hudson/jobs/XXX/workspace/target/surefire-reports

      -------------------------------------------------------
      T E S T S
      -------------------------------------------------------
      There are no tests to run.

      Results :

      Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

      [JENKINS] Recording test results
      forkedProjectSucceeded XXX2.11.0-SNAPSHOT
      [JENKINS] Archiving /buildtools/hudson/jobs/XXX/workspace/pom.xml to /buildtools/hudson/jobs/XXX/modules/XXX$XXX/builds/2011-05-24_10-45-01/archive/XXX/XXX/2.11.0-SNAPSHOT/XXX-2.11.0-SNAPSHOT.pom
      mojo forkSucceeded org.codehaus.mojo:cobertura-maven-plugin:2.5(default)
      [JENKINS] cobertura-maven-plugin already configured with xml reports enabled
      [INFO]
      [INFO] — cobertura-maven-plugin:2.5:cobertura (default) @ XXX —
      [INFO] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
      Cobertura: Loaded information on 61 classes.
      Report time: 9847ms

      [INFO] Cobertura Report generation was successful.
      [JENKINS] Recording coverage results
      projectSucceeded XXX:2.11.0-SNAPSHOT
      [JENKINS] Archiving /buildtools/hudson/jobs/XXX/workspace/target/XXX-2.11.0-SNAPSHOT.jar to /buildtools/hudson/jobs/XXX/modules/XXX$XXX/builds/2011-05-24_10-45-01/archive/XXX/XXX/2.11.0-SNAPSHOT/XXX-2.11.0-SNAPSHOT.jar
      sessionEnded
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 35.413s
      [INFO] Finished at: Tue May 24 10:45:44 CDT 2011
      [INFO] Final Memory: 14M/136M
      [INFO] ------------------------------------------------------------------------
      channel stopped
      Publishing Cobertura coverage report...
      Publishing Cobertura coverage results...
      Sending e-mails to: XXX
      Finished: SUCCESS

          [JENKINS-9757] Cobertura plugin fails maven builds unless workspace is whiped

          John Felczak added a comment - - edited

          We've started to get the same "[JENKINS] Unable to add link to cobertura results" at the end of several of our builds. In our case, however, wiping the workspace does not make any difference.

          Once the error starts happening in our builds, the only way to stop it appears to be to (1) uncheck "Publish Cobertura Coverage Report", and, in addition, (2) remove "cobertura:cobertura" from the Maven Goals and Options field.

          In other words, if the cobertura results files get generated, it looks as though the plugin tries and fails to publish them, and thereby fails the build, even if we tell it not to publish them.

          Not sure if a separate bug should be filed for this variant case, or if it were better to keep it part of the present report.

          Jenkins ver. 1.411 running on CentOS. Happens under both maven 3.0 and 2.2 as well.

          John Felczak added a comment - - edited We've started to get the same " [JENKINS] Unable to add link to cobertura results" at the end of several of our builds. In our case, however, wiping the workspace does not make any difference. Once the error starts happening in our builds, the only way to stop it appears to be to (1) uncheck "Publish Cobertura Coverage Report", and , in addition, (2) remove "cobertura:cobertura" from the Maven Goals and Options field. In other words, if the cobertura results files get generated, it looks as though the plugin tries and fails to publish them, and thereby fails the build, even if we tell it not to publish them. Not sure if a separate bug should be filed for this variant case, or if it were better to keep it part of the present report. Jenkins ver. 1.411 running on CentOS. Happens under both maven 3.0 and 2.2 as well.

          Fabian Vogler added a comment -

          Adding a Pre Step with mvn test solved it for me.

          Fabian Vogler added a comment - Adding a Pre Step with mvn test solved it for me.

          Ben Rometsch added a comment -

          I'm seeing this error, but wiping the workspace makes no difference to me.

          Ben Rometsch added a comment - I'm seeing this error, but wiping the workspace makes no difference to me.

          Ben Rometsch added a comment -

          Sorry - just to update - wiping the workspace DOES FIX the problem for me.

          Ben Rometsch added a comment - Sorry - just to update - wiping the workspace DOES FIX the problem for me.

          Ben Rometsch added a comment -

          Is there a way to automatically clear down the workspace before a build?

          Ben Rometsch added a comment - Is there a way to automatically clear down the workspace before a build?

          Kai Virkki added a comment - - edited

          I'm also experiencing failing maven builds when using Cobertura and there is an existing workspace. When I clean the workspace, the build might start working. Sometimes it works with an existing workspace, but rarely.

          I'm using CloudBees dev@cloud.

          This is the error that comes to the output: "[JENKINS] Unable to add link to cobertura results"

          Kai Virkki added a comment - - edited I'm also experiencing failing maven builds when using Cobertura and there is an existing workspace. When I clean the workspace, the build might start working. Sometimes it works with an existing workspace, but rarely. I'm using CloudBees dev@cloud. This is the error that comes to the output: " [JENKINS] Unable to add link to cobertura results"

          Kai Virkki added a comment -

          When I added clean to the list of maven operations, everything started to work!

          So, instead of this: "mvn install", I now have "mvn clean install".

          Hope that this helps others too!

          Kai Virkki added a comment - When I added clean to the list of maven operations, everything started to work! So, instead of this: "mvn install", I now have "mvn clean install". Hope that this helps others too!

          Olaf Bergner added a comment - - edited

          We've been bitten by this, too, and I'm afraid that wiping the workspace prior to building - either by executing maven's "clean" phase or using Jenkins' support for doing so - is no solution for us. We use maven's incremental build plugin to greatly speed up our builds, and this does obviously not work when previously compiled class files are erased. So we at least desperately need a fix. Plus, invoking "clean" does not fix this problem in our case.

          What annoys me personally most about this issue is the inordinate amount of time it took me to track our build's failing to this root cause. There is nothing - neither on Jenkins job page proper nor in the console output - to clearly tell a user what made Jenkins fail the build. I strongly suggest to adopt a policy of always clearly and prominently publishing why a certain build failed. Sending users on a wild goose chase is, well, impolite.

          Olaf Bergner added a comment - - edited We've been bitten by this, too, and I'm afraid that wiping the workspace prior to building - either by executing maven's "clean" phase or using Jenkins' support for doing so - is no solution for us. We use maven's incremental build plugin to greatly speed up our builds, and this does obviously not work when previously compiled class files are erased. So we at least desperately need a fix. Plus, invoking "clean" does not fix this problem in our case. What annoys me personally most about this issue is the inordinate amount of time it took me to track our build's failing to this root cause. There is nothing - neither on Jenkins job page proper nor in the console output - to clearly tell a user what made Jenkins fail the build. I strongly suggest to adopt a policy of always clearly and prominently publishing why a certain build failed. Sending users on a wild goose chase is, well, impolite.

          Last two releases (separated by over a year) were by olivergondza so looks like the maintainer

          Stephen Connolly added a comment - Last two releases (separated by over a year) were by olivergondza so looks like the maintainer

            Unassigned Unassigned
            trigertas Todd Rigertas
            Votes:
            6 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: