GitHub user seusher opened a pull request: https://github.com/apache/maven-plugins/pull/101
getProjectModules: IllegalStateException In my project, we have multiple modules, some of which also contain other modules. When building one specific module (which itself had child modules) from the root pom file, the build would fail when maven-assembly-plugin threw an IllegalStateException, but building from the module's pom.xml file directly, the build succeeded. I narrowed this down to the candidateIterator being set to null after .remove() is called, and that iterator not being updated to the next item before using it as a candidate for other projects. This change ensures that after removing the item from the iterator, that we move to the next item before doing anymore comparisons. This is the stacktrace from the maven-assembly-plugin failure: ``` [ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.5.5:single (default) on project Flatternscore_by_tenantid_daily: Execution def ault of goal org.apache.maven.plugins:maven-assembly-plugin:2.5.5:single failed. IllegalStateException -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.5.5:single (default) on projec t Flatternscore_by_tenantid_daily: Execution default of goal org.apache.maven.plugins:maven-assembly-plugin:2.5.5:single failed. at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286) at org.apache.maven.cli.MavenCli.main(MavenCli.java:197) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) 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) Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default of goal org.apache.maven.plugins:maven-assembly-plugin:2.5.5:single failed. at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 20 more Caused by: java.lang.IllegalStateException at java.util.LinkedHashMap$LinkedHashIterator.remove(LinkedHashMap.java:722) at org.apache.maven.plugin.assembly.utils.ProjectUtils.getProjectModules(ProjectUtils.java:128) at org.apache.maven.plugin.assembly.archive.phase.ModuleSetAssemblyPhase.getModuleProjects(ModuleSetAssemblyPhase.java:566) at org.apache.maven.plugin.assembly.archive.phase.ModuleSetAssemblyPhase$1.accept(ModuleSetAssemblyPhase.java:134) at org.apache.maven.plugin.assembly.model.Assemblies.forEachModuleSet(Assemblies.java:40) at org.apache.maven.plugin.assembly.archive.phase.ModuleSetAssemblyPhase.execute(ModuleSetAssemblyPhase.java:126) at org.apache.maven.plugin.assembly.archive.DefaultAssemblyArchiver.createArchive(DefaultAssemblyArchiver.java:178) at org.apache.maven.plugin.assembly.mojos.AbstractAssemblyMojo.execute(AbstractAssemblyMojo.java:484) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) ... 21 more ``` You can merge this pull request into a Git repository by running: $ git pull https://github.com/seusher/maven-plugins trunk Alternatively you can review and apply these changes as the patch at: https://github.com/apache/maven-plugins/pull/101.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #101 ---- commit e868c25b6317f9874afbac69814526f7e841edba Author: seusher <seus...@live.com> Date: 2016-12-15T00:41:44Z getProjectModules: IllegalStateException In my project, we have multiple modules, some of which also contain other modules. When building one specific module (which itself had child modules) from the root pom file, the build would fail when maven-assembly-plugin threw an IllegalStateException, but building from the module's pom.xml file directly, the build succeeded. I narrowed this down to the candidateIterator being set to null after .remove() is called, and that iterator not being updated to the next item before using it as a candidate for other projects. ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org For additional commands, e-mail: dev-h...@maven.apache.org