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

IllegalStateException from MavenProject.getParent can break MavenFingerprinter.recordParents

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      If custom settings.xml are used for a job in such a way that parent POMs are not accessible without considering the full environment of model building (details TBD), it can happen that the Maven build itself succeeds yet MavenFingerprinter.recordParents fails to find parent POMs and so aborts the build. The root problem is the use of MavenProject.getParent, which is very problematic and in fact can throw an undocumented exception as MNG-5075 notes.

      Any such exception should be caught, perhaps logged, and fingerprinting should proceed.

      Further, the model should be computed in such a way that the parent can be resolved to begin with. This may mean dropping usages of getParent.

        Attachments

          Activity

          Hide
          jglick Jesse Glick added a comment -

          The full exception, in case that build log becomes inaccessible:

          org.apache.maven.InternalErrorException: Internal error: java.lang.IllegalStateException: Failed to build parent project for org.jenkins-ci.plugins:ant:hpi:1.3-SNAPSHOT
          	at org.apache.maven.lifecycle.internal.BuilderCommon.handleBuildError(BuilderCommon.java:128)
          	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:95)
          	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
          	at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
          	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
          	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
          	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
          	at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79)
          	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:601)
          	at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
          	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
          	at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:158)
          	at hudson.maven.Maven3Builder.call(Maven3Builder.java:104)
          	at hudson.maven.Maven3Builder.call(Maven3Builder.java:70)
          	at hudson.remoting.UserRequest.perform(UserRequest.java:118)
          	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
          	at hudson.remoting.Request$2.run(Request.java:287)
          	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
          	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
          	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
          	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
          	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
          	at java.lang.Thread.run(Thread.java:722)
          Caused by: java.lang.IllegalStateException: Failed to build parent project for org.jenkins-ci.plugins:ant:hpi:1.3-SNAPSHOT
          	at org.apache.maven.project.MavenProject.getParent(MavenProject.java:378)
          	at hudson.maven.reporters.MavenFingerprinter.recordParents(MavenFingerprinter.java:141)
          	at hudson.maven.reporters.MavenFingerprinter.postBuild(MavenFingerprinter.java:110)
          	at hudson.maven.Maven3Builder$MavenExecutionListener.recordProjectSucceeded(Maven3Builder.java:349)
          	at hudson.maven.Maven3Builder$MavenExecutionListener.projectSucceeded(Maven3Builder.java:323)
          	at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:74)
          	at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:42)
          	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:91)
          	... 24 more
          Caused by: org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
          [ERROR] Unresolveable build extension: Plugin org.jenkins-ci.tools:maven-hpi-plugin:1.74 or one of its dependencies could not be resolved: Could not find artifact org.jenkins-ci.tools:maven-hpi-plugin:jar:1.74 in central (http://repo.cloudbees.com/content/repositories/central) @ 
          
          	at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:176)
          	at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:309)
          	at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:267)
          	at org.apache.maven.project.MavenProject.getParent(MavenProject.java:374)
          	... 31 more
          Caused by: org.apache.maven.model.building.ModelBuildingException: 1 problem was encountered while building the effective model for org.jenkins-ci.plugins:plugin:1.456
          [ERROR] Unresolveable build extension: Plugin org.jenkins-ci.tools:maven-hpi-plugin:1.74 or one of its dependencies could not be resolved: Could not find artifact org.jenkins-ci.tools:maven-hpi-plugin:jar:1.74 in central (http://repo.cloudbees.com/content/repositories/central) @ 
          
          	at org.apache.maven.model.building.DefaultModelProblemCollector.newModelBuildingException(DefaultModelProblemCollector.java:195)
          	at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:419)
          	at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:371)
          	at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:362)
          	at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:232)
          	at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:142)
          	... 34 more
          
          Show
          jglick Jesse Glick added a comment - The full exception, in case that build log becomes inaccessible: org.apache.maven.InternalErrorException: Internal error: java.lang.IllegalStateException: Failed to build parent project for org.jenkins-ci.plugins:ant:hpi:1.3-SNAPSHOT at org.apache.maven.lifecycle.internal.BuilderCommon.handleBuildError(BuilderCommon.java:128) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:95) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79) 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:601) at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239) at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:158) at hudson.maven.Maven3Builder.call(Maven3Builder.java:104) at hudson.maven.Maven3Builder.call(Maven3Builder.java:70) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:287) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:722) Caused by: java.lang.IllegalStateException: Failed to build parent project for org.jenkins-ci.plugins:ant:hpi:1.3-SNAPSHOT at org.apache.maven.project.MavenProject.getParent(MavenProject.java:378) at hudson.maven.reporters.MavenFingerprinter.recordParents(MavenFingerprinter.java:141) at hudson.maven.reporters.MavenFingerprinter.postBuild(MavenFingerprinter.java:110) at hudson.maven.Maven3Builder$MavenExecutionListener.recordProjectSucceeded(Maven3Builder.java:349) at hudson.maven.Maven3Builder$MavenExecutionListener.projectSucceeded(Maven3Builder.java:323) at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:74) at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:42) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:91) ... 24 more Caused by: org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs: [ERROR] Unresolveable build extension: Plugin org.jenkins-ci.tools:maven-hpi-plugin:1.74 or one of its dependencies could not be resolved: Could not find artifact org.jenkins-ci.tools:maven-hpi-plugin:jar:1.74 in central (http://repo.cloudbees.com/content/repositories/central) @ at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:176) at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:309) at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:267) at org.apache.maven.project.MavenProject.getParent(MavenProject.java:374) ... 31 more Caused by: org.apache.maven.model.building.ModelBuildingException: 1 problem was encountered while building the effective model for org.jenkins-ci.plugins:plugin:1.456 [ERROR] Unresolveable build extension: Plugin org.jenkins-ci.tools:maven-hpi-plugin:1.74 or one of its dependencies could not be resolved: Could not find artifact org.jenkins-ci.tools:maven-hpi-plugin:jar:1.74 in central (http://repo.cloudbees.com/content/repositories/central) @ at org.apache.maven.model.building.DefaultModelProblemCollector.newModelBuildingException(DefaultModelProblemCollector.java:195) at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:419) at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:371) at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:362) at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:232) at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:142) ... 34 more
          Hide
          stephenconnolly Stephen Connolly added a comment -

          Actually there are no custom settings.xml required at all to trigger this issue.

          For example if you build the Jenkins ant-plugin using a Maven Project type on a clean system with no settings.xml defined at all, this issue can occur as the <repositories> defined within the project are not consulted.

          Most people have probably been avoiding this error by defining a settings.xml that adds the repositories to the effective list up front

          Show
          stephenconnolly Stephen Connolly added a comment - Actually there are no custom settings.xml required at all to trigger this issue. For example if you build the Jenkins ant-plugin using a Maven Project type on a clean system with no settings.xml defined at all, this issue can occur as the <repositories> defined within the project are not consulted. Most people have probably been avoiding this error by defining a settings.xml that adds the repositories to the effective list up front
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Jesse Glick
          Path:
          changelog.html
          maven-plugin/src/main/java/hudson/maven/reporters/MavenFingerprinter.java
          http://jenkins-ci.org/commit/jenkins/d477296ffd3114f9f8416981f82e49cace605600
          Log:
          JENKINS-17775 If MavenProject.getParent throws ISE during fingerprinting, report it but at least proceed.
          Proper fix is to ensure that the model resolution uses the same environment as the actual build,
          or is otherwise more lenient about finding the parent (e.g. enables plugin resolution).

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: changelog.html maven-plugin/src/main/java/hudson/maven/reporters/MavenFingerprinter.java http://jenkins-ci.org/commit/jenkins/d477296ffd3114f9f8416981f82e49cace605600 Log: JENKINS-17775 If MavenProject.getParent throws ISE during fingerprinting, report it but at least proceed. Proper fix is to ensure that the model resolution uses the same environment as the actual build, or is otherwise more lenient about finding the parent (e.g. enables plugin resolution).
          Hide
          dogfood dogfood added a comment -

          Integrated in jenkins_main_trunk #2497
          JENKINS-17775 If MavenProject.getParent throws ISE during fingerprinting, report it but at least proceed. (Revision d477296ffd3114f9f8416981f82e49cace605600)

          Result = SUCCESS
          Jesse Glick : d477296ffd3114f9f8416981f82e49cace605600
          Files :

          • changelog.html
          • maven-plugin/src/main/java/hudson/maven/reporters/MavenFingerprinter.java
          Show
          dogfood dogfood added a comment - Integrated in jenkins_main_trunk #2497 JENKINS-17775 If MavenProject.getParent throws ISE during fingerprinting, report it but at least proceed. (Revision d477296ffd3114f9f8416981f82e49cace605600) Result = SUCCESS Jesse Glick : d477296ffd3114f9f8416981f82e49cace605600 Files : changelog.html maven-plugin/src/main/java/hudson/maven/reporters/MavenFingerprinter.java
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Jesse Glick
          Path:
          changelog.html
          maven-plugin/src/main/java/hudson/maven/MavenBuildInformation.java
          maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
          maven-plugin/src/main/java/hudson/maven/reporters/MavenFingerprinter.java
          http://jenkins-ci.org/commit/jenkins/0c4fe2ddbac2963c0b633fe27bb1a6016134da50
          Log:
          [FIXED JENKINS-17775] Find (model) parent POMs properly during fingerprint recording at end of build.

          Compare: https://github.com/jenkinsci/jenkins/compare/3f0f25fc6ba9...0c4fe2ddbac2

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: changelog.html maven-plugin/src/main/java/hudson/maven/MavenBuildInformation.java maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java maven-plugin/src/main/java/hudson/maven/reporters/MavenFingerprinter.java http://jenkins-ci.org/commit/jenkins/0c4fe2ddbac2963c0b633fe27bb1a6016134da50 Log: [FIXED JENKINS-17775] Find (model) parent POMs properly during fingerprint recording at end of build. Compare: https://github.com/jenkinsci/jenkins/compare/3f0f25fc6ba9...0c4fe2ddbac2
          Hide
          dogfood dogfood added a comment -

          Integrated in jenkins_main_trunk #2500
          [FIXED JENKINS-17775] Find (model) parent POMs properly during fingerprint recording at end of build. (Revision 0c4fe2ddbac2963c0b633fe27bb1a6016134da50)

          Result = SUCCESS
          Jesse Glick : 0c4fe2ddbac2963c0b633fe27bb1a6016134da50
          Files :

          • changelog.html
          • maven-plugin/src/main/java/hudson/maven/reporters/MavenFingerprinter.java
          • maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
          • maven-plugin/src/main/java/hudson/maven/MavenBuildInformation.java
          Show
          dogfood dogfood added a comment - Integrated in jenkins_main_trunk #2500 [FIXED JENKINS-17775] Find (model) parent POMs properly during fingerprint recording at end of build. (Revision 0c4fe2ddbac2963c0b633fe27bb1a6016134da50) Result = SUCCESS Jesse Glick : 0c4fe2ddbac2963c0b633fe27bb1a6016134da50 Files : changelog.html maven-plugin/src/main/java/hudson/maven/reporters/MavenFingerprinter.java maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java maven-plugin/src/main/java/hudson/maven/MavenBuildInformation.java
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/hudson/maven/reporters/MavenFingerprinter.java
          http://jenkins-ci.org/commit/maven-plugin/b4ae662e415ce1c24a61d254af7438722ca7ba0a
          Log:
          JENKINS-17775 If MavenProject.getParent throws ISE during fingerprinting, report it but at least proceed.
          Proper fix is to ensure that the model resolution uses the same environment as the actual build,
          or is otherwise more lenient about finding the parent (e.g. enables plugin resolution).
          Originally-Committed-As: d477296ffd3114f9f8416981f82e49cace605600

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/hudson/maven/reporters/MavenFingerprinter.java http://jenkins-ci.org/commit/maven-plugin/b4ae662e415ce1c24a61d254af7438722ca7ba0a Log: JENKINS-17775 If MavenProject.getParent throws ISE during fingerprinting, report it but at least proceed. Proper fix is to ensure that the model resolution uses the same environment as the actual build, or is otherwise more lenient about finding the parent (e.g. enables plugin resolution). Originally-Committed-As: d477296ffd3114f9f8416981f82e49cace605600
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/hudson/maven/MavenBuildInformation.java
          src/main/java/hudson/maven/MavenModuleSetBuild.java
          src/main/java/hudson/maven/reporters/MavenFingerprinter.java
          http://jenkins-ci.org/commit/maven-plugin/36c841fd65d1b487150701bacc761ef9d5ca6541
          Log:
          [FIXED JENKINS-17775] Find (model) parent POMs properly during fingerprint recording at end of build.
          Originally-Committed-As: 0c4fe2ddbac2963c0b633fe27bb1a6016134da50

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/hudson/maven/MavenBuildInformation.java src/main/java/hudson/maven/MavenModuleSetBuild.java src/main/java/hudson/maven/reporters/MavenFingerprinter.java http://jenkins-ci.org/commit/maven-plugin/36c841fd65d1b487150701bacc761ef9d5ca6541 Log: [FIXED JENKINS-17775] Find (model) parent POMs properly during fingerprint recording at end of build. Originally-Committed-As: 0c4fe2ddbac2963c0b633fe27bb1a6016134da50

            People

            • Assignee:
              jglick Jesse Glick
              Reporter:
              jglick Jesse Glick
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: