[ https://issues.apache.org/jira/browse/MENFORCER-477?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Peter De Maeyer updated MENFORCER-477: -------------------------------------- Description: I have a snapshot project that has a snapshot parent. At release time, I want to use the enforcer plugin to make sure the release version of my project only depends on release versions, including the parent, so I use {{failWhenParentIsSnapshot=true}}. For snapshot versions of my project, I want to _allow_ snapshot dependencies including snapshot parent, so I use {{onlyWhenRelease=true}} to disable the enforcer for snapshot versions. *Expected:* my snapshot project build succeeds with a snapshot parent. *Actual:* my snapshot project build _fails_ with a snapshot parent, despite {{onlyWhenRelease=true}}. I suspect that {{failWhenParentIsSnapshot}} does not take {{onlyWhenRelease}} into account. The intuitive fix for me would be that the combination of both options behaves as expected. I imagine that maybe it is a design choice to keep both options completely independent of each other, so an acceptable alternative for me would be to introduce yet another option, e.g. {{onlyWhenParentIsRelease}} that behaves similar to {{onlyWhenRelease}} but applies to the parent only. {noformat} [WARNING] [WARNING] Some problems were encountered while building the effective settings [WARNING] Unrecognised tag: 'properties' (position: START_TAG seen ...</servers>\n\t<properties>... @13:14) @ /home/peter/.m2/settings.xml, line 13, column 14 [WARNING] [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for su.pernova:assertions-parent:pom:1.1.0-SNAPSHOT [WARNING] 'build.pluginManagement.plugins.plugin.(groupId:artifactId)' must be unique but found duplicate declaration of plugin org.apache.maven.plugins:maven-failsafe-plugin @ su.pernova:bom:1.1.0-SNAPSHOT, /home/peter/.m2/repository/su/pernova/bom/1.1.0-SNAPSHOT/bom-1.1.0-SNAPSHOT.pom, line 263, column 17 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] Inspecting build with total of 5 modules... [INFO] Installing Nexus Staging features: [INFO] ... total of 5 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] Supernova Assertions - Parent [pom] [INFO] Supernova Assertions - Main [jar] [INFO] Supernova Assertions - JUnit 4 [jar] [INFO] Supernova Assertions - JUnit 5 [jar] [INFO] Supernova Assertions - JUnit 4 + JUnit 5 [jar] [INFO] [INFO] --------------------< su.pernova:assertions-parent >-------------------- [INFO] Building Supernova Assertions - Parent 1.1.0-SNAPSHOT [1/5] [INFO] --------------------------------[ pom ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:3.2.0:clean (default-clean) @ assertions-parent --- [INFO] [INFO] --- flatten-maven-plugin:1.3.0:clean (flatten-clean) @ assertions-parent --- [INFO] [INFO] --- maven-enforcer-plugin:3.2.1:enforce (enforce-no-snapshots-in-releases) @ assertions-parent --- [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary for Supernova Assertions - Parent 1.1.0-SNAPSHOT: [INFO] [INFO] Supernova Assertions - Parent ...................... FAILURE [ 0.464 s] [INFO] Supernova Assertions - Main ........................ SKIPPED [INFO] Supernova Assertions - JUnit 4 ..................... SKIPPED [INFO] Supernova Assertions - JUnit 5 ..................... SKIPPED [INFO] Supernova Assertions - JUnit 4 + JUnit 5 ........... SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.023 s [INFO] Finished at: 2023-04-06T21:12:23+02:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.2.1:enforce (enforce-no-snapshots-in-releases) on project assertions-parent: [ERROR] Rule 0: org.apache.maven.enforcer.rules.dependency.RequireReleaseDeps failed with message: [ERROR] Parent Cannot be a snapshot: su.pernova:bom:pom:1.1.0-SNAPSHOT [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] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException {noformat} was: I have a snapshot project that has a snapshot parent. At release time, I want to use the enforcer plugin to make sure the release version of my project only depends on release versions, including the parent, so I use {{failWhenParentIsSnapshot=true}}. For snapshot versions of my project, I want to _allow_ snapshot dependencies including snapshot parent, so I use {{onlyWhenRelease=true}} to disable the enforcer for snapshot versions. *Expected:* my snapshot project build succeeds with a snapshot parent. *Actual:* my snapshot project build _fails_ with a snapshot parent, despite {{onlyWhenRelease=true}}. I suspect that {{failWhenParentIsSnapshot}} does not take {{onlyWhenRelease}} into account. The intuitive fix for me would be that the combination of both options behaves as expected. I imagine that maybe it is a design choice to keep both options completely independent of each other, so an acceptable alternative for me would be to introduce yet another option, e.g. {{onlyWhenParentIsRelease}} that behaves similar to {{onlyWhenRelease}} but applies to the parent only. > failWhenParentIsSnapshot does not respect onlyWhenRelease > --------------------------------------------------------- > > Key: MENFORCER-477 > URL: https://issues.apache.org/jira/browse/MENFORCER-477 > Project: Maven Enforcer Plugin > Issue Type: Bug > Affects Versions: 3.2.1 > Reporter: Peter De Maeyer > Priority: Major > > I have a snapshot project that has a snapshot parent. > At release time, I want to use the enforcer plugin to make sure the release > version of my project only depends on release versions, including the parent, > so I use {{failWhenParentIsSnapshot=true}}. > For snapshot versions of my project, I want to _allow_ snapshot dependencies > including snapshot parent, so I use {{onlyWhenRelease=true}} to disable the > enforcer for snapshot versions. > *Expected:* my snapshot project build succeeds with a snapshot parent. > *Actual:* my snapshot project build _fails_ with a snapshot parent, despite > {{onlyWhenRelease=true}}. > I suspect that {{failWhenParentIsSnapshot}} does not take {{onlyWhenRelease}} > into account. > The intuitive fix for me would be that the combination of both options > behaves as expected. > I imagine that maybe it is a design choice to keep both options completely > independent of each other, so an acceptable alternative for me would be to > introduce yet another option, e.g. {{onlyWhenParentIsRelease}} that behaves > similar to {{onlyWhenRelease}} but applies to the parent only. > {noformat} > [WARNING] > [WARNING] Some problems were encountered while building the effective settings > [WARNING] Unrecognised tag: 'properties' (position: START_TAG seen > ...</servers>\n\t<properties>... @13:14) @ /home/peter/.m2/settings.xml, > line 13, column 14 > [WARNING] > [INFO] Scanning for projects... > [WARNING] > [WARNING] Some problems were encountered while building the effective model > for su.pernova:assertions-parent:pom:1.1.0-SNAPSHOT > [WARNING] 'build.pluginManagement.plugins.plugin.(groupId:artifactId)' must > be unique but found duplicate declaration of plugin > org.apache.maven.plugins:maven-failsafe-plugin @ > su.pernova:bom:1.1.0-SNAPSHOT, > /home/peter/.m2/repository/su/pernova/bom/1.1.0-SNAPSHOT/bom-1.1.0-SNAPSHOT.pom, > line 263, column 17 > [WARNING] > [WARNING] It is highly recommended to fix these problems because they > threaten the stability of your build. > [WARNING] > [WARNING] For this reason, future Maven versions might no longer support > building such malformed projects. > [WARNING] > [INFO] Inspecting build with total of 5 modules... > [INFO] Installing Nexus Staging features: > [INFO] ... total of 5 executions of maven-deploy-plugin replaced with > nexus-staging-maven-plugin > [INFO] > ------------------------------------------------------------------------ > [INFO] Reactor Build Order: > [INFO] > [INFO] Supernova Assertions - Parent > [pom] > [INFO] Supernova Assertions - Main > [jar] > [INFO] Supernova Assertions - JUnit 4 > [jar] > [INFO] Supernova Assertions - JUnit 5 > [jar] > [INFO] Supernova Assertions - JUnit 4 + JUnit 5 > [jar] > [INFO] > [INFO] --------------------< su.pernova:assertions-parent > >-------------------- > [INFO] Building Supernova Assertions - Parent 1.1.0-SNAPSHOT > [1/5] > [INFO] --------------------------------[ pom > ]--------------------------------- > [INFO] > [INFO] --- maven-clean-plugin:3.2.0:clean (default-clean) @ assertions-parent > --- > [INFO] > [INFO] --- flatten-maven-plugin:1.3.0:clean (flatten-clean) @ > assertions-parent --- > [INFO] > [INFO] --- maven-enforcer-plugin:3.2.1:enforce > (enforce-no-snapshots-in-releases) @ assertions-parent --- > [INFO] > ------------------------------------------------------------------------ > [INFO] Reactor Summary for Supernova Assertions - Parent 1.1.0-SNAPSHOT: > [INFO] > [INFO] Supernova Assertions - Parent ...................... FAILURE [ 0.464 > s] > [INFO] Supernova Assertions - Main ........................ SKIPPED > [INFO] Supernova Assertions - JUnit 4 ..................... SKIPPED > [INFO] Supernova Assertions - JUnit 5 ..................... SKIPPED > [INFO] Supernova Assertions - JUnit 4 + JUnit 5 ........... SKIPPED > [INFO] > ------------------------------------------------------------------------ > [INFO] BUILD FAILURE > [INFO] > ------------------------------------------------------------------------ > [INFO] Total time: 1.023 s > [INFO] Finished at: 2023-04-06T21:12:23+02:00 > [INFO] > ------------------------------------------------------------------------ > [ERROR] Failed to execute goal > org.apache.maven.plugins:maven-enforcer-plugin:3.2.1:enforce > (enforce-no-snapshots-in-releases) on project assertions-parent: > [ERROR] Rule 0: org.apache.maven.enforcer.rules.dependency.RequireReleaseDeps > failed with message: > [ERROR] Parent Cannot be a snapshot: su.pernova:bom:pom:1.1.0-SNAPSHOT > [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] > [ERROR] For more information about the errors and possible solutions, please > read the following articles: > [ERROR] [Help 1] > http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException > {noformat} -- This message was sent by Atlassian Jira (v8.20.10#820010)