Description
Within release:prepare, in the check SCM modifications phase, an IllegalStateException occurs in case multiple exclusion patterns match.
In my case, I configured the release.properties to be ignored, even though this is already ignored by default.
The bug is at org.apache.maven.shared.release.phase.ScmCheckModificationsPhase.execute(ScmCheckModificationsPhase.java:169) where Iterator.remove() is called from within the for-loop. If multiple patterns match, Iterator.remove() is called multiple times which is of course illegal.
To fix this, it should be enough to add a "break" after the i.remove() call at org.apache.maven.shared.release.phase.ScmCheckModificationsPhase.execute(ScmCheckModificationsPhase.java:169). See attached patch.
POM excerpt:
... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-release-plugin</artifactId> <configuration> <checkModificationExcludes> <checkModificationExclude>build-number.txt</checkModificationExclude> <checkModificationExclude>release.properties</checkModificationExclude> <checkModificationExclude>pom.xml.versionsBackup</checkModificationExclude> </checkModificationExcludes> </configuration> </plugin> ...
Stacktrace:
... [DEBUG] ? release.properties [DEBUG] Ignoring changed file: release.properties [DEBUG] Ignoring changed file: release.properties [INFO] ------------------------------------------------------------------------ [ERROR] FATAL ERROR [INFO] ------------------------------------------------------------------------ [INFO] null [INFO] ------------------------------------------------------------------------ [DEBUG] Trace java.lang.IllegalStateException at java.util.AbstractList$Itr.remove(AbstractList.java:356) at org.apache.maven.shared.release.phase.ScmCheckModificationsPhase.execute(ScmCheckModificationsPhase.java:169) at org.apache.maven.shared.release.phase.ScmCheckModificationsPhase.simulate(ScmCheckModificationsPhase.java:199) at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:228) at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:169) at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:146) at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:107) at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:291) at org.apache.maven.plugins.release.PrepareReleaseMojo.execute(PrepareReleaseMojo.java:247) 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.executeStandaloneGoal(DefaultLifecycleExecutor.java:569) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387 ) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:284) 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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) 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)