[ 
https://issues.jenkins-ci.org/browse/JENKINS-12808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=159174#comment-159174
 ] 

Marco Schulze commented on JENKINS-12808:
-----------------------------------------

I found out how to make the 2nd surefire-run (after the skipped 
cobertura-instrumentalisation) fail the whole build:

https://dev.nightlabs.org/jenkins/job/org.nightlabs.test20120216/7/console

If a method of a unit test returns an instance of a class that is located in 
the same project's src/main/java/, then surefire crashes when it tries to 
collect the test methods and the build breaks.
                
> cobertura-maven-plugin: cannot be deactivated + fails with 
> NullPointerException + version 2.5.1 cannot be overwritten
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: JENKINS-12808
>                 URL: https://issues.jenkins-ci.org/browse/JENKINS-12808
>             Project: Jenkins
>          Issue Type: Bug
>          Components: cobertura
>    Affects Versions: current
>         Environment: Tested with Jenkins 1.451
>            Reporter: Marco Schulze
>            Assignee: stephenconnolly
>            Priority: Blocker
>
> There are three problems related to the cobertura-maven-plugin:
> 1) Even though my project does NOT have the cobertura-maven-plugin in its 
> build/plugins-section, this maven-plugin is magically added by Jenkins to the 
> build process. I did NOT enable any cobertura-related setting in the job, 
> either.
> 2) The cobertura-maven-plugin causes the build to fail with a 
> NullPointerException:
> Caused by: java.lang.NullPointerException
>       at java.util.ArrayList.addAll(ArrayList.java:472)
>       at 
> org.codehaus.mojo.cobertura.CoberturaReportMojo.getAllChildren(CoberturaReportMojo.java:574)
>       at 
> org.codehaus.mojo.cobertura.CoberturaReportMojo.executeAggregateReport(CoberturaReportMojo.java:275)
>       at 
> org.codehaus.mojo.cobertura.CoberturaReportMojo.executeAggregateReport(CoberturaReportMojo.java:265)
>       at 
> org.codehaus.mojo.cobertura.CoberturaReportMojo.executeReport(CoberturaReportMojo.java:251)
>       at 
> org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:93)
> ...
> 3) It seems to be impossible to override the version of the 
> cobertura-maven-plugin: No matter what version I declare in my parent-POM's 
> pluginManagement, Jenkins always uses version 2.5.1
> For you to reproduce, I created a new project from scratch (I only copied 
> some files from other projects and stripped most of their contents). Here are 
> all the links:
> Project's SVN URL: 
> https://dev.nightlabs.org/svn/public/main/experimentals/test20120216/
> First build: 
> https://dev.nightlabs.org/jenkins/job/org.nightlabs.test20120216/1/console
> This build has been done with cobertura-maven-plugin's version being set to 
> 2.4 in my plugin-MANAGEMENT. Still the build on Jenkins uses version 2.5.1. 
> Note, that the cobertura-maven-plugin is NOT listed in the plugins-section 
> (but only in the pluginManagement). Therefore, it should not be included in 
> the build process at all. When I run the build locally with "mvn clean 
> install", it does not occur, too. Here's the log: 
> https://dev.nightlabs.org/svn/public/main/experimentals/test20120216/org.nightlabs.test20120216.all/mvn_clean_install.ganesha.log
> Second build: 
> https://dev.nightlabs.org/jenkins/job/org.nightlabs.test20120216/2/console
> This build has been done with the cobertura-maven-plugin being commented out 
> from the pluginManagement. Now, the "Effective POM" in m2e shows me NO 
> Cobertura AT ALL anymore and still the result is the same.
> 3rd and 4th build: 
> I added configuration/skip=true in the parent-POM with the result that the 
> build now works fine. But it does so only, because there is no unit test, yet 
> (there is an *integration* test, but no *unit* test).
> 5th build: 
> https://dev.nightlabs.org/jenkins/job/org.nightlabs.test20120216/5/console
> I added a unit test which produces this error in the log output (when being 
> run the 2nd time):
> *********
> Tests in error: 
>   doSomething(org.nightlabs.test20120216.client.test.SomeTest): 
> org/nightlabs/test20120216/client/TestClient
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
> [ERROR] There are test failures.
> *********
> Despite this error, the build succeeds. However, this is not always the case: 
> In another project, this is handled as a fatal error and breaks the build. I 
> was not able to find out where's the difference. However, this 2nd test run 
> should not happen at all in the first place.
> The problem is obviously that the cobertura-maven-plugin is correctly skipped 
> (and thus does not instrument any class), but the unit-tests are still 
> executed twice. And the second time, it tries to access instrumented classes, 
> which do not exist.
> Here's what I did in Jenkins (version 1.451) to create the job (I did NOT 
> enable any cobertura-related things!):
> => New Job
> ==> Job name = org.nightlabs.test20120216
> ==> Build a maven2/3 project
> ==> OK
> ==> Enable project-based security
> ===> Read access for Anonymous
> ==> Source Code Management
> ===> Subversion CHECKED
> ===> Repository URL = 
> https://dev.nightlabs.org/svn/public/main/experimentals/test20120216/
> ===> Check-out Strategy = Emulate clean checkout by first deleting 
> unversioned/ignored files, then 'svn update'
> ==> Build
> ===> Root POM = org.nightlabs.test20120216.all/pom.xml
> ==> Save

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to