NullPointerException building maven projects which don't use junit/don't have tests

Bug #965061 reported by James Page on 2012-03-26
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
surefire (Ubuntu)
High
James Page
Precise
High
James Page

Bug Description

The most recent patch applied to surefire to correct detection of JUnit 4 breaks when a maven project does not use junit - the artifact is null but its not checked correctly:

[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.NullPointerException
 at org.apache.maven.plugin.surefire.AbstractSurefireMojo.isAnyJunit4(AbstractSurefireMojo.java:320)
 at org.apache.maven.plugin.surefire.AbstractSurefireMojo.access$300(AbstractSurefireMojo.java:79)
 at org.apache.maven.plugin.surefire.AbstractSurefireMojo$JUnitCoreProviderInfo.isApplicable(AbstractSurefireMojo.java:1260)
 at org.apache.maven.plugin.surefire.ProviderList.autoDetectOneProvider(ProviderList.java:77)
 at org.apache.maven.plugin.surefire.ProviderList.resolve(ProviderList.java:69)
 at org.apache.maven.plugin.surefire.AbstractSurefireMojo.createProviders(AbstractSurefireMojo.java:161)
 at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAllProviders(AbstractSurefireMojo.java:172)
 at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:135)
 at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:98)
 at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
 at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
 at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
 at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
 at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
 at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
 at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
 at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
 at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
 at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
 at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
 at org.debian.maven.Wrapper.main(Wrapper.java:106)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:616)
 at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
 at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
 at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
 at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: libsurefire-java 2.10-2ubuntu1
ProcVersionSignature: Ubuntu 3.2.0-20.32-generic 3.2.12
Uname: Linux 3.2.0-20-generic x86_64
NonfreeKernelModules: fglrx
ApportVersion: 1.95-0ubuntu1
Architecture: amd64
Date: Mon Mar 26 09:35:23 2012
PackageArchitecture: all
SourcePackage: surefire
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

James Page (james-page) wrote :
Changed in surefire (Ubuntu):
status: New → In Progress
importance: Undecided → High
assignee: nobody → James Page (james-page)
milestone: none → ubuntu-12.04-beta-2
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package surefire - 2.10-2ubuntu2

---------------
surefire (2.10-2ubuntu2) precise; urgency=low

  * d/patches/fix-junit-provider-selection.patch: Updated patch to deal
    maven projects which don't have any unit tests/don't depend on
    junit which caused a NPE (LP: #965061).
 -- James Page <email address hidden> Mon, 26 Mar 2012 09:46:26 +0100

Changed in surefire (Ubuntu Precise):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers