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

Surefire plugin produces NullPointerException when using Java 10

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I tried running Maven install using Java 10 on the latest version of the repository 3.0.0-beta6-SNAPSHOT but got a NullPointerException.  I found that version 2.20.1 is reported to have an issue  with 
      org.apache.maven.surefire.shade.org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast(SystemUtils.java:1626)
      I think git-client-plugin just needs to be upgraded to the fixed version of Surefire: 2.21.0

      maven install -e

      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test (default-test) on project git-client: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test failed.: NullPointerException -> [Help 1]
      org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test (default-test) on project git-client: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test failed.
      {{ at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)}}
      {{ at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)}}
      {{ at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)}}
      {{ at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)}}
      {{ at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)}}
      {{ at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)}}
      {{ at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)}}
      {{ at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)}}
      {{ at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)}}
      {{ at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)}}
      {{ at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)}}
      {{ at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)}}
      {{ at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)}}
      {{ at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)}}
      {{ at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)}}
      {{ at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)}}
      {{ at java.lang.reflect.Method.invoke (Method.java:564)}}
      {{ at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)}}
      {{ at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)}}
      {{ at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)}}
      {{ at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)}}
      {{ at org.codehaus.classworlds.Launcher.main (Launcher.java:47)}}
      Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test failed.
      {{ at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:148)}}
      {{ at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)}}
      {{ at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)}}
      {{ at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)}}
      {{ at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)}}
      {{ at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)}}
      {{ at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)}}
      {{ at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)}}
      {{ at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)}}
      {{ at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)}}
      {{ at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)}}
      {{ at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)}}
      {{ at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)}}
      {{ at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)}}
      {{ at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)}}
      {{ at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)}}
      {{ at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)}}
      {{ at java.lang.reflect.Method.invoke (Method.java:564)}}
      {{ at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)}}
      {{ at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)}}
      {{ at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)}}
      {{ at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)}}
      {{ at org.codehaus.classworlds.Launcher.main (Launcher.java:47)}}
      Caused by: java.lang.NullPointerException
      {{ at org.apache.maven.surefire.shade.org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast (SystemUtils.java:1626)}}
      {{ at org.apache.maven.plugin.surefire.AbstractSurefireMojo.getEffectiveJvm (AbstractSurefireMojo.java:2107)}}
      {{ at org.apache.maven.plugin.surefire.AbstractSurefireMojo.getForkConfiguration (AbstractSurefireMojo.java:1976)}}
      {{ at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider (AbstractSurefireMojo.java:1111)}}
      {{ at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked (AbstractSurefireMojo.java:954)}}
      {{ at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute (AbstractSurefireMojo.java:832)}}
      {{ at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)}}
      {{ at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)}}
      {{ at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)}}
      {{ at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)}}
      {{ at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)}}
      {{ at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)}}
      {{ at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)}}
      {{ at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)}}
      {{ at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)}}
      {{ at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)}}
      {{ at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)}}
      {{ at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)}}
      {{ at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)}}
      {{ at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)}}
      {{ at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)}}
      {{ at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)}}
      {{ at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)}}
      {{ at java.lang.reflect.Method.invoke (Method.java:564)}}
      {{ at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)}}
      {{ at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)}}
      {{ at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)}}
      {{ at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)}}
      {{ at org.codehaus.classworlds.Launcher.main (Launcher.java:47)}}

       

        Attachments

          Activity

          Hide
          aakoch Adam Koch added a comment -
          Show
          aakoch Adam Koch added a comment - Pull request opened:  https://github.com/jenkinsci/git-client-plugin/pull/355
          Hide
          markewaite Mark Waite added a comment -

          The pull request looks good to me. However, I can't duplicate the problem because I can't compile the git client plugin with Java 10. Can you provide more details on your configuration that allows you to compile the git client plugin with Java 10?

          Steps I used:

          1. Switch to Java 10
            $ export JAVA_HOME=/home/mwaite/mark-pc2.markwaite.net-agent/tools/hudson.model.JDK/jdk10/jdk-10.0.2
            $ export PATH=$JAVA_HOME/bin:$PATH
            $ java -version
            java version "10.0.2" 2018-07-17
            Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
            Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)
            
          2. Confirm maven version runs with Java 10
            $ mvn --version
            Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T12:33:14-06:00)
            Maven home: /home/mwaite/mark-pc2.markwaite.net-agent/tools/hudson.tasks.Maven_MavenInstallation/mvn/apache-maven-3.5.4
            Java version: 10.0.2, vendor: Oracle Corporation, runtime: /home/mwaite/mark-pc2.markwaite.net-agent/tools/hudson.model.JDK/jdk10/jdk-10.0.2
            Default locale: en_US, platform encoding: UTF-8
            OS name: "linux", version: "4.4.0-133-generic", arch: "amd64", family: "unix"
            
          3. Clone git client plugin master branch
            $ git clone https://github.com/jenkinsci/git-client-plugin
            $ cd git-client-plugin
            
          4. Compile git client plugin master branch with JDK 10 and Maven 3.5.4
            $ mvn compile
            [INFO] Scanning for projects...
            [INFO]
            [INFO] -----------------< org.jenkins-ci.plugins:git-client >------------------
            [INFO] Building Jenkins Git client plugin 3.0.0-beta6-SNAPSHOT
            [INFO] --------------------------------[ hpi ]---------------------------------
            [INFO]
            [INFO] --- maven-hpi-plugin:2.6:validate (default-validate) @ git-client ---
            [INFO]
            [INFO] --- maven-enforcer-plugin:3.0.0-M1:display-info (display-info) @ git-client ---
            [INFO] Maven Version: 3.5.4
            [INFO] JDK Version: 10.0.2 normalized as: 10.0.2
            [INFO] OS Info: Arch: amd64 Family: unix Name: linux Version: 4.4.0-133-generic
            [INFO]
            [INFO] --- maven-enforcer-plugin:3.0.0-M1:enforce (display-info) @ git-client ---
            [INFO] Ignoring requireUpperBoundDeps in com.google.guava:guava
            [INFO]
            [INFO] --- maven-localizer-plugin:1.24:generate (default) @ git-client ---
            [INFO]
            [INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ git-client ---
            [INFO] Using 'UTF-8' encoding to copy filtered resources.
            [INFO] Copying 16 resources
            [INFO]
            [INFO] --- flatten-maven-plugin:1.0.1:flatten (flatten) @ git-client ---
            [INFO] Generating flattened POM of project org.jenkins-ci.plugins:git-client:hpi:3.0.0-beta6-SNAPSHOT...
            [INFO]
            [INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ git-client ---
            [INFO] Changes detected - recompiling the module!
            [INFO] Compiling 48 source files to /home/mwaite/git/jenkins/git-client-plugin/git-client-plugin/target/classes
            [INFO] /home/mwaite/git/jenkins/git-client-plugin/git-client-plugin/src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java: Some input files use or override a deprecated API.
            [INFO] /home/mwaite/git/jenkins/git-client-plugin/git-client-plugin/src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java: Recompile with -Xlint:deprecation for details.
            [INFO] -------------------------------------------------------------
            [ERROR] COMPILATION ERROR :
            [INFO] -------------------------------------------------------------
            [ERROR] java.nio.file.NoSuchFileException: /home/mwaite/git/jenkins/git-client-plugin/git-client-plugin/target/classes/META-INF/annotations/hudson.Extension
            [INFO] 1 error
            [INFO] -------------------------------------------------------------
            [INFO] ------------------------------------------------------------------------
            [INFO] BUILD FAILURE
            [INFO] ------------------------------------------------------------------------
            [INFO] Total time: 3.861 s
            [INFO] Finished at: 2018-08-19T16:36:30-06:00
            [INFO] ------------------------------------------------------------------------
            [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project git-client: Compilation failure
            [ERROR] java.nio.file.NoSuchFileException: /home/mwaite/git/jenkins/git-client-plugin/git-client-plugin/target/classes/META-INF/annotations/hudson.Extension
            [ERROR]
            [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]
            

          I have no objection to updating the surefire plugin version to a newer version. That's a good move in any case.

          I would like to understand the difference between your environment and mine. Are you using a newer version of Java 10 or a newer version of Maven or something different?

          Show
          markewaite Mark Waite added a comment - The pull request looks good to me. However, I can't duplicate the problem because I can't compile the git client plugin with Java 10. Can you provide more details on your configuration that allows you to compile the git client plugin with Java 10? Steps I used: Switch to Java 10 $ export JAVA_HOME=/home/mwaite/mark-pc2.markwaite.net-agent/tools/hudson.model.JDK/jdk10/jdk-10.0.2 $ export PATH=$JAVA_HOME/bin:$PATH $ java -version java version "10.0.2" 2018-07-17 Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13) Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode) Confirm maven version runs with Java 10 $ mvn --version Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T12:33:14-06:00) Maven home: /home/mwaite/mark-pc2.markwaite.net-agent/tools/hudson.tasks.Maven_MavenInstallation/mvn/apache-maven-3.5.4 Java version: 10.0.2, vendor: Oracle Corporation, runtime: /home/mwaite/mark-pc2.markwaite.net-agent/tools/hudson.model.JDK/jdk10/jdk-10.0.2 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "4.4.0-133-generic", arch: "amd64", family: "unix" Clone git client plugin master branch $ git clone https://github.com/jenkinsci/git-client-plugin $ cd git-client-plugin Compile git client plugin master branch with JDK 10 and Maven 3.5.4 $ mvn compile [INFO] Scanning for projects... [INFO] [INFO] -----------------< org.jenkins-ci.plugins:git-client >------------------ [INFO] Building Jenkins Git client plugin 3.0.0-beta6-SNAPSHOT [INFO] --------------------------------[ hpi ]--------------------------------- [INFO] [INFO] --- maven-hpi-plugin:2.6:validate (default-validate) @ git-client --- [INFO] [INFO] --- maven-enforcer-plugin:3.0.0-M1:display-info (display-info) @ git-client --- [INFO] Maven Version: 3.5.4 [INFO] JDK Version: 10.0.2 normalized as: 10.0.2 [INFO] OS Info: Arch: amd64 Family: unix Name: linux Version: 4.4.0-133-generic [INFO] [INFO] --- maven-enforcer-plugin:3.0.0-M1:enforce (display-info) @ git-client --- [INFO] Ignoring requireUpperBoundDeps in com.google.guava:guava [INFO] [INFO] --- maven-localizer-plugin:1.24:generate (default) @ git-client --- [INFO] [INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ git-client --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 16 resources [INFO] [INFO] --- flatten-maven-plugin:1.0.1:flatten (flatten) @ git-client --- [INFO] Generating flattened POM of project org.jenkins-ci.plugins:git-client:hpi:3.0.0-beta6-SNAPSHOT... [INFO] [INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ git-client --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 48 source files to /home/mwaite/git/jenkins/git-client-plugin/git-client-plugin/target/classes [INFO] /home/mwaite/git/jenkins/git-client-plugin/git-client-plugin/src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java: Some input files use or override a deprecated API. [INFO] /home/mwaite/git/jenkins/git-client-plugin/git-client-plugin/src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java: Recompile with -Xlint:deprecation for details. [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] java.nio.file.NoSuchFileException: /home/mwaite/git/jenkins/git-client-plugin/git-client-plugin/target/classes/META-INF/annotations/hudson.Extension [INFO] 1 error [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.861 s [INFO] Finished at: 2018-08-19T16:36:30-06:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project git-client: Compilation failure [ERROR] java.nio.file.NoSuchFileException: /home/mwaite/git/jenkins/git-client-plugin/git-client-plugin/target/classes/META-INF/annotations/hudson.Extension [ERROR] [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] I have no objection to updating the surefire plugin version to a newer version. That's a good move in any case. I would like to understand the difference between your environment and mine. Are you using a newer version of Java 10 or a newer version of Maven or something different?
          Hide
          oleg_nenashev Oleg Nenashev added a comment -

          Jenkins development toolchain is not Java10-ready (see JENKINS-40689). Some fixes still need to be applied

          Show
          oleg_nenashev Oleg Nenashev added a comment - Jenkins development toolchain is not Java10-ready (see JENKINS-40689 ). Some fixes still need to be applied
          Hide
          markewaite Mark Waite added a comment -

          Merged to master branch in PR-355.

          Show
          markewaite Mark Waite added a comment - Merged to master branch in PR-355 .

            People

            • Assignee:
              Unassigned
              Reporter:
              aakoch Adam Koch
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: