New maven build plan yielding NPE (have not successfully built before):

      Started by user anonymous
      [EnvInject] - Loading node environment variables.
      Building in workspace /Users/buildbot/.jenkins/jobs/Java-Base/workspace
      > git rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repository
      > git config remote.origin.url ssh://***/dtcore-java.git # timeout=10
      Fetching upstream changes from ssh://***/dtcore-java.git
      > git --version # timeout=10
      using GIT_SSH to set credentials buildbot
      > git -c core.askpass=true fetch --tags --progress ssh://**/dtcore-java.git +refs/heads/:refs/remotes/origin/*
      > git rev-parse refs/remotes/origin/master^

      {commit} # timeout=10
      > git rev-parse refs/remotes/origin/origin/master^{commit}

      # timeout=10
      Checking out Revision 90abc6da0e0b2d5baad7890b39452ebcd110aa93 (refs/remotes/origin/master)
      > git config core.sparsecheckout # timeout=10
      > git checkout -f 90abc6da0e0b2d5baad7890b39452ebcd110aa93
      > git rev-list 90abc6da0e0b2d5baad7890b39452ebcd110aa93 # timeout=10
      ERROR: Processing failed due to a bug in the code. Please report this to jenkinsci-users@googlegroups.com
      java.lang.NullPointerException
      at com.nirima.jenkins.SelectionTypeProject.getLastSuccessfulBuildNumber(SelectionTypeProject.java:117)
      at com.nirima.jenkins.SelectionTypeProject.getAction(SelectionTypeProject.java:97)
      at com.nirima.jenkins.RepositoryDefinitionProperty$1.buildEnvVars(RepositoryDefinitionProperty.java:83)
      at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:944)
      at hudson.maven.AbstractMavenBuild.getEnvironment(AbstractMavenBuild.java:56)
      at hudson.maven.MavenModuleSetBuild.getEnvironment(MavenModuleSetBuild.java:167)
      at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:677)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)
      at hudson.model.Run.execute(Run.java:1744)
      at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531)
      at hudson.model.ResourceController.execute(ResourceController.java:98)
      at hudson.model.Executor.run(Executor.java:374)
      project=hudson.maven.MavenModuleSet@328caa39[Java-Base]
      project.getModules()=[]
      project.getRootModule()=null
      FATAL: null
      java.lang.NullPointerException
      at com.nirima.jenkins.SelectionTypeProject.getLastSuccessfulBuildNumber(SelectionTypeProject.java:117)
      at com.nirima.jenkins.SelectionTypeProject.getAction(SelectionTypeProject.java:97)
      at com.nirima.jenkins.RepositoryDefinitionProperty$1.buildEnvVars(RepositoryDefinitionProperty.java:83)
      at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:944)
      at hudson.maven.AbstractMavenBuild.getEnvironment(AbstractMavenBuild.java:56)
      at hudson.maven.MavenModuleSetBuild.getEnvironment(MavenModuleSetBuild.java:167)
      at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:677)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)
      at hudson.model.Run.execute(Run.java:1744)
      at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531)
      at hudson.model.ResourceController.execute(ResourceController.java:98)
      at hudson.model.Executor.run(Executor.java:374)
      [BFA] Scanning build for known causes...
      [BFA] No failure causes found
      [BFA] Done. 0s
      Finished: FAILURE

          [JENKINS-28341] NPE for First Maven Build

          Shouldn't this:

          --- SelectionTypeProject.java.orig      2015-09-08 00:08:51.290503000 -0400
          +++ SelectionTypeProject.java   2015-09-08 00:10:15.956625000 -0400
          @@ -114,7 +114,15 @@
               private int getLastSuccessfulBuildNumber(final String project) {
                   BuildableItemWithBuildWrappers item = getProject(project);
           
          -        return item.asProject().getLastSuccessfulBuild().getNumber();
          +        if(item.asProject().getLastSuccessfulBuild() != null)
          +        {
          +            item.asProject().getLastSuccessfulBuild().getNumber();
          +        }
          +        else
          +        {
          +            return 0; // no previous success
          +        }
          +  
               }
           
               private int getPromotedBuildNumber(final String project, final String promoted) {
          

          be sufficient? I am also running into this bug.

          Johannes Dieterich added a comment - Shouldn't this: --- SelectionTypeProject.java.orig 2015-09-08 00:08:51.290503000 -0400 +++ SelectionTypeProject.java 2015-09-08 00:10:15.956625000 -0400 @@ -114,7 +114,15 @@ private int getLastSuccessfulBuildNumber( final String project) { BuildableItemWithBuildWrappers item = getProject(project); - return item.asProject().getLastSuccessfulBuild().getNumber(); + if (item.asProject().getLastSuccessfulBuild() != null ) + { + item.asProject().getLastSuccessfulBuild().getNumber(); + } + else + { + return 0; // no previous success + } + } private int getPromotedBuildNumber( final String project, final String promoted) { be sufficient? I am also running into this bug.

          Ben Fallah added a comment -

          What's the status on this?

          I just installed/configured maven/jenkins/git and all other plugins

          one project built fine.
          Another new one that has dependencies on the first one..failed with this same message

          Checking out Revision ff5a3c14a43d098ad468254db38cb14078a3a748 (refs/remotes/origin/master)
          > /usr/bin/git config core.sparsecheckout # timeout=10
          > /usr/bin/git checkout -f ff5a3c14a43d098ad468254db38cb14078a3a748
          > /usr/bin/git rev-list ff5a3c14a43d098ad468254db38cb14078a3a748 # timeout=10
          ERROR: Processing failed due to a bug in the code. Please report this to jenkinsci-users@googlegroups.com
          java.lang.NullPointerException
          at com.nirima.jenkins.SelectionTypeProject.getLastSuccessfulBuildNumber(SelectionTypeProject.java:117)
          at com.nirima.jenkins.SelectionTypeProject.getAction(SelectionTypeProject.java:97)
          at com.nirima.jenkins.RepositoryDefinitionProperty$1.buildEnvVars(RepositoryDefinitionProperty.java:83)
          at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:944)
          at hudson.maven.AbstractMavenBuild.getEnvironment(AbstractMavenBuild.java:56)
          at hudson.maven.MavenModuleSetBuild.getEnvironment(MavenModuleSetBuild.java:166)
          at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:677)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)
          at hudson.model.Run.execute(Run.java:1741)
          at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:408)

          Ben Fallah added a comment - What's the status on this? I just installed/configured maven/jenkins/git and all other plugins one project built fine. Another new one that has dependencies on the first one..failed with this same message Checking out Revision ff5a3c14a43d098ad468254db38cb14078a3a748 (refs/remotes/origin/master) > /usr/bin/git config core.sparsecheckout # timeout=10 > /usr/bin/git checkout -f ff5a3c14a43d098ad468254db38cb14078a3a748 > /usr/bin/git rev-list ff5a3c14a43d098ad468254db38cb14078a3a748 # timeout=10 ERROR: Processing failed due to a bug in the code. Please report this to jenkinsci-users@googlegroups.com java.lang.NullPointerException at com.nirima.jenkins.SelectionTypeProject.getLastSuccessfulBuildNumber(SelectionTypeProject.java:117) at com.nirima.jenkins.SelectionTypeProject.getAction(SelectionTypeProject.java:97) at com.nirima.jenkins.RepositoryDefinitionProperty$1.buildEnvVars(RepositoryDefinitionProperty.java:83) at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:944) at hudson.maven.AbstractMavenBuild.getEnvironment(AbstractMavenBuild.java:56) at hudson.maven.MavenModuleSetBuild.getEnvironment(MavenModuleSetBuild.java:166) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:677) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537) at hudson.model.Run.execute(Run.java:1741) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:408)

          Ben Fallah added a comment - - edited

          I think here is the order of how maven rep server plugin bug can appear:

          If you make a maven job and then do a build first and then install the plugin, it will continue to build without error.
          All other new jobs it'll fail with the last buildnumber exception

          I disabled the plugin and all maven jobs are working fine now.

          So again, I think , if you create all your jobs and do a build first and then install the repo sever plugin, then you might get away with it!

          Ben Fallah added a comment - - edited I think here is the order of how maven rep server plugin bug can appear: If you make a maven job and then do a build first and then install the plugin, it will continue to build without error. All other new jobs it'll fail with the last buildnumber exception I disabled the plugin and all maven jobs are working fine now. So again, I think , if you create all your jobs and do a build first and then install the repo sever plugin, then you might get away with it!

          Eric Smalling added a comment -

          The only way I am able to duplicate this is by following these steps (on a brand new Jenkins install)
          1. Install Maven_Repository_Plugin and config JDK and Maven
          2. Create a project named "Foo" with a Maven build step (I'm using git@github.com:cloudbeers/basic.git as a test repo)
          3. Create another project named "Bar" that declares "Foo" as it's maven repo and has any kind of build step (i.e. "echo hello" in a shell)
          4. Build "Bar" - it will fail with an NPE.

          It makes sense for "Bar" to fail because there is no build of "Foo" to refer to, although the error could be more descriptive than an NPE stack trace.

          Once a successful build of "Foo" occurs, "Bar" stops failing.

          Is this the use case of the original bug poster here?

          Eric Smalling added a comment - The only way I am able to duplicate this is by following these steps (on a brand new Jenkins install) 1. Install Maven_Repository_Plugin and config JDK and Maven 2. Create a project named "Foo" with a Maven build step (I'm using git@github.com:cloudbeers/basic.git as a test repo) 3. Create another project named "Bar" that declares "Foo" as it's maven repo and has any kind of build step (i.e. "echo hello" in a shell) 4. Build "Bar" - it will fail with an NPE. It makes sense for "Bar" to fail because there is no build of "Foo" to refer to, although the error could be more descriptive than an NPE stack trace. Once a successful build of "Foo" occurs, "Bar" stops failing. Is this the use case of the original bug poster here?

          Ben Fallah added a comment - - edited

          How you duplicated, perhaps is another use case that can trigger the error. I can understand that.

          In my case..I had one maven job working fine then I installed repo server plugin and configured it on same job and it built fine.. and then I created new maven jobs that were depended on first job and also many other new jobs that were independent sources and all kept failing.

          oh --I forgot..I also had maven installed and set manually..in all the jobs..and I finally created a new maven automatically managed by maven..and freestyle built started working..,...then I removed the plugin... might be related.but i doubt..

          Ben Fallah added a comment - - edited How you duplicated, perhaps is another use case that can trigger the error. I can understand that. In my case..I had one maven job working fine then I installed repo server plugin and configured it on same job and it built fine.. and then I created new maven jobs that were depended on first job and also many other new jobs that were independent sources and all kept failing. oh --I forgot..I also had maven installed and set manually..in all the jobs..and I finally created a new maven automatically managed by maven..and freestyle built started working..,...then I removed the plugin... might be related.but i doubt..

          Eric Smalling added a comment -

          Going to "Stop Progress" on the ticket for now until I hear back from the original poster (Zack).

          Also, the patch above that would return a 0 would, IMO, be bad; if there is no upstream build to refer to than a failure should occur. As I said earlier, though, a different exception should probably be thrown.

          Eric Smalling added a comment - Going to "Stop Progress" on the ticket for now until I hear back from the original poster (Zack). Also, the patch above that would return a 0 would, IMO, be bad; if there is no upstream build to refer to than a failure should occur. As I said earlier, though, a different exception should probably be thrown.

            esmalling Eric Smalling
            zachcalvert Zach Calvert
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: