Re: Remove SNAPSHOT from all sub-modules, but honor version
Try https://github.com/aleksandr-m/gitflow-maven-plugin So for me dropping the -SNAPSHOT would mean I'm creating a gitflow release branch for testing, which would be as simply using that plugin as `mvn gitflow:release-start`. Not tried it with different modules having different version so it might not work. Personally everything in the same repo having the same version number I find easier, so if you want different modules with different versions then I would put them if separate repositories. Cheers, John On Sat, 2 Apr 2022 at 11:14, Mantas Gridinas wrote: > From what I gather you want versions plugin by mojohaus. "Set" goal has > flag for removing snapshot declarations as -DremoveSnapshot. > > https://www.mojohaus.org/versions-maven-plugin/ > > On Sat, Apr 2, 2022, 11:32 Mike Deitrick wrote: > > > Any guidance on this matter? > > > > On Fri, Mar 4, 2022, 7:53 AM Mike Deitrick > > wrote: > > > > > Hello, > > > > > > A couple days ago I submitted a question on Stack Overflow about this > > > topic. It can be found here > > > < > > > https://stackoverflow.com/questions/71329400/remove-snapshot-from-all-maven-sub-modules-but-honor-version > > >. > > > For the purposes of preserving this conversation, I will also provide > my > > > question below, along with some things I've found along the way. The > > > commenter mentioned that the version of all modules within a > multi-module > > > project should be the same to drop -SNAPSHOT with the mvn versions:set > > command. > > > Furthermore, a section in the POM file title Aggregation (or > > Multi-Module) > > > <https://maven.apache.org/pom.html#aggregation-or-multi-module> seems > to > > > provide some insight into what's going on, but my inferences might be > > > incorrect about versions needing to be consistent based on the content > in > > > that section. > > > > > > So, what is the official practice for versions of sub-modules in a > > > multi-module project? Should all versions be the same as the version in > > the > > > parent POM? If it's acceptable for sub-module versions to be different, > > how > > > does one accomplish stripping -SNAPSHOT from all modules (preferably > > with a > > > Maven plugin versus running commands to iterate over all > sub-directories > > to > > > find child POMs and drop -SNAPSHOT from each)? > > > > > > Thank you. > > > Mike > > > > > > --- > > > > > > I am working on a multi-module project. For the purposes of this > exercise > > > we can assume there are two sub-modules. The articles Maven Simple > > > Project Archetype > > > <https://maven.apache.org/archetypes/maven-archetype-simple/> and > Create > > > an archetype from a multi-module project > > > < > > > https://maven.apache.org/archetype/maven-archetype-plugin/examples/create-multi-module-project.html > > > > can > > > be referenced to follow along. > > > > > > Parent - 1.0.0-SNAPSHOT > > > ChildA - 1.2.3-SNAPSHOT > > > ChildB - 1.0.0-SNAPSHOT > > > > > > When I run mvn versions:set -D removeSnapshot -D processAllModules I > > > expect the versions to change as indicated below. > > > > > > Parent - 1.0.0 > > > ChildA - 1.2.3 > > > ChildB - 1.0.0 > > > > > > But, it seems -SNAPSHOT is stripped from all versions except the > children > > > that have a different version from the parent. > > > > > > Parent - 1.0.0 > > > ChildA - 1.2.3-SNAPSHOT > > > ChildB - 1.0.0 > > > > > > Is there any way to run the mvn versions:set command to honor the > version > > > number, while stripping the -SNAPSHOT postfix? > > > -- > > > > > > *UPDATE #1* > > > > > > Running mvn versions:set -D removeSnapshot=true yields the same results > > > as running mvn versions:set -D removeSnapshot -D processAllModules. > > > > > > Parent - 1.0.0 > > > ChildA - 1.2.3-SNAPSHOT > > > ChildB - 1.0.0 > > > > > > > > >
Re: Remove SNAPSHOT from all sub-modules, but honor version
>From what I gather you want versions plugin by mojohaus. "Set" goal has flag for removing snapshot declarations as -DremoveSnapshot. https://www.mojohaus.org/versions-maven-plugin/ On Sat, Apr 2, 2022, 11:32 Mike Deitrick wrote: > Any guidance on this matter? > > On Fri, Mar 4, 2022, 7:53 AM Mike Deitrick > wrote: > > > Hello, > > > > A couple days ago I submitted a question on Stack Overflow about this > > topic. It can be found here > > < > https://stackoverflow.com/questions/71329400/remove-snapshot-from-all-maven-sub-modules-but-honor-version > >. > > For the purposes of preserving this conversation, I will also provide my > > question below, along with some things I've found along the way. The > > commenter mentioned that the version of all modules within a multi-module > > project should be the same to drop -SNAPSHOT with the mvn versions:set > command. > > Furthermore, a section in the POM file title Aggregation (or > Multi-Module) > > <https://maven.apache.org/pom.html#aggregation-or-multi-module> seems to > > provide some insight into what's going on, but my inferences might be > > incorrect about versions needing to be consistent based on the content in > > that section. > > > > So, what is the official practice for versions of sub-modules in a > > multi-module project? Should all versions be the same as the version in > the > > parent POM? If it's acceptable for sub-module versions to be different, > how > > does one accomplish stripping -SNAPSHOT from all modules (preferably > with a > > Maven plugin versus running commands to iterate over all sub-directories > to > > find child POMs and drop -SNAPSHOT from each)? > > > > Thank you. > > Mike > > > > --- > > > > I am working on a multi-module project. For the purposes of this exercise > > we can assume there are two sub-modules. The articles Maven Simple > > Project Archetype > > <https://maven.apache.org/archetypes/maven-archetype-simple/> and Create > > an archetype from a multi-module project > > < > https://maven.apache.org/archetype/maven-archetype-plugin/examples/create-multi-module-project.html> > can > > be referenced to follow along. > > > > Parent - 1.0.0-SNAPSHOT > > ChildA - 1.2.3-SNAPSHOT > > ChildB - 1.0.0-SNAPSHOT > > > > When I run mvn versions:set -D removeSnapshot -D processAllModules I > > expect the versions to change as indicated below. > > > > Parent - 1.0.0 > > ChildA - 1.2.3 > > ChildB - 1.0.0 > > > > But, it seems -SNAPSHOT is stripped from all versions except the children > > that have a different version from the parent. > > > > Parent - 1.0.0 > > ChildA - 1.2.3-SNAPSHOT > > ChildB - 1.0.0 > > > > Is there any way to run the mvn versions:set command to honor the version > > number, while stripping the -SNAPSHOT postfix? > > -- > > > > *UPDATE #1* > > > > Running mvn versions:set -D removeSnapshot=true yields the same results > > as running mvn versions:set -D removeSnapshot -D processAllModules. > > > > Parent - 1.0.0 > > ChildA - 1.2.3-SNAPSHOT > > ChildB - 1.0.0 > > > > >
Re: Remove SNAPSHOT from all sub-modules, but honor version
Hi Mike, The convention to keep modules versions the same can be enforced https://maven.apache.org/enforcer/enforcer-rules/reactorModuleConvergence.html When they're the same you can drop the version tag and let children inherit that from the parent. But you'll still need to edit the parent/version. SNAPSHOT is part of the version number, not a classifier, so version-maven-plugin is evidently filtering the projects before transforming the version number. I set my ${changelist} property to "-SNAPSHOT" to manage this, i.e. 3.3.0${changelist} If you dont want to do that and its still too much work to manually edit version you can try an xslt transform sudo apt install libsaxonb-java xmlstartlet sponge while read pom; do saxonb-xslt -s:$pom -xsl:/tmp/remove-snapshot.xslt | xmlstarlet fo | sponge $pom; done < <(find . -iname pom.xml) Delany /tmp/remove-snapshot.xslt http://www.w3.org/1999/XSL/Transform;> On Sat, 2 Apr 2022 at 10:32, Mike Deitrick wrote: > Any guidance on this matter? > > On Fri, Mar 4, 2022, 7:53 AM Mike Deitrick > wrote: > > > Hello, > > > > A couple days ago I submitted a question on Stack Overflow about this > > topic. It can be found here > > < > https://stackoverflow.com/questions/71329400/remove-snapshot-from-all-maven-sub-modules-but-honor-version > >. > > For the purposes of preserving this conversation, I will also provide my > > question below, along with some things I've found along the way. The > > commenter mentioned that the version of all modules within a multi-module > > project should be the same to drop -SNAPSHOT with the mvn versions:set > command. > > Furthermore, a section in the POM file title Aggregation (or > Multi-Module) > > <https://maven.apache.org/pom.html#aggregation-or-multi-module> seems to > > provide some insight into what's going on, but my inferences might be > > incorrect about versions needing to be consistent based on the content in > > that section. > > > > So, what is the official practice for versions of sub-modules in a > > multi-module project? Should all versions be the same as the version in > the > > parent POM? If it's acceptable for sub-module versions to be different, > how > > does one accomplish stripping -SNAPSHOT from all modules (preferably > with a > > Maven plugin versus running commands to iterate over all sub-directories > to > > find child POMs and drop -SNAPSHOT from each)? > > > > Thank you. > > Mike > > > > --- > > > > I am working on a multi-module project. For the purposes of this exercise > > we can assume there are two sub-modules. The articles Maven Simple > > Project Archetype > > <https://maven.apache.org/archetypes/maven-archetype-simple/> and Create > > an archetype from a multi-module project > > < > https://maven.apache.org/archetype/maven-archetype-plugin/examples/create-multi-module-project.html> > can > > be referenced to follow along. > > > > Parent - 1.0.0-SNAPSHOT > > ChildA - 1.2.3-SNAPSHOT > > ChildB - 1.0.0-SNAPSHOT > > > > When I run mvn versions:set -D removeSnapshot -D processAllModules I > > expect the versions to change as indicated below. > > > > Parent - 1.0.0 > > ChildA - 1.2.3 > > ChildB - 1.0.0 > > > > But, it seems -SNAPSHOT is stripped from all versions except the children > > that have a different version from the parent. > > > > Parent - 1.0.0 > > ChildA - 1.2.3-SNAPSHOT > > ChildB - 1.0.0 > > > > Is there any way to run the mvn versions:set command to honor the version > > number, while stripping the -SNAPSHOT postfix? > > -- > > > > *UPDATE #1* > > > > Running mvn versions:set -D removeSnapshot=true yields the same results > > as running mvn versions:set -D removeSnapshot -D processAllModules. > > > > Parent - 1.0.0 > > ChildA - 1.2.3-SNAPSHOT > > ChildB - 1.0.0 > > > > >
Re: Remove SNAPSHOT from all sub-modules, but honor version
Any guidance on this matter? On Fri, Mar 4, 2022, 7:53 AM Mike Deitrick wrote: > Hello, > > A couple days ago I submitted a question on Stack Overflow about this > topic. It can be found here > <https://stackoverflow.com/questions/71329400/remove-snapshot-from-all-maven-sub-modules-but-honor-version>. > For the purposes of preserving this conversation, I will also provide my > question below, along with some things I've found along the way. The > commenter mentioned that the version of all modules within a multi-module > project should be the same to drop -SNAPSHOT with the mvn versions:set > command. > Furthermore, a section in the POM file title Aggregation (or Multi-Module) > <https://maven.apache.org/pom.html#aggregation-or-multi-module> seems to > provide some insight into what's going on, but my inferences might be > incorrect about versions needing to be consistent based on the content in > that section. > > So, what is the official practice for versions of sub-modules in a > multi-module project? Should all versions be the same as the version in the > parent POM? If it's acceptable for sub-module versions to be different, how > does one accomplish stripping -SNAPSHOT from all modules (preferably with a > Maven plugin versus running commands to iterate over all sub-directories to > find child POMs and drop -SNAPSHOT from each)? > > Thank you. > Mike > > --- > > I am working on a multi-module project. For the purposes of this exercise > we can assume there are two sub-modules. The articles Maven Simple > Project Archetype > <https://maven.apache.org/archetypes/maven-archetype-simple/> and Create > an archetype from a multi-module project > <https://maven.apache.org/archetype/maven-archetype-plugin/examples/create-multi-module-project.html> > can > be referenced to follow along. > > Parent - 1.0.0-SNAPSHOT > ChildA - 1.2.3-SNAPSHOT > ChildB - 1.0.0-SNAPSHOT > > When I run mvn versions:set -D removeSnapshot -D processAllModules I > expect the versions to change as indicated below. > > Parent - 1.0.0 > ChildA - 1.2.3 > ChildB - 1.0.0 > > But, it seems -SNAPSHOT is stripped from all versions except the children > that have a different version from the parent. > > Parent - 1.0.0 > ChildA - 1.2.3-SNAPSHOT > ChildB - 1.0.0 > > Is there any way to run the mvn versions:set command to honor the version > number, while stripping the -SNAPSHOT postfix? > -- > > *UPDATE #1* > > Running mvn versions:set -D removeSnapshot=true yields the same results > as running mvn versions:set -D removeSnapshot -D processAllModules. > > Parent - 1.0.0 > ChildA - 1.2.3-SNAPSHOT > ChildB - 1.0.0 > >
Remove SNAPSHOT from all sub-modules, but honor version
Hello, A couple days ago I submitted a question on Stack Overflow about this topic. It can be found here <https://stackoverflow.com/questions/71329400/remove-snapshot-from-all-maven-sub-modules-but-honor-version>. For the purposes of preserving this conversation, I will also provide my question below, along with some things I've found along the way. The commenter mentioned that the version of all modules within a multi-module project should be the same to drop -SNAPSHOT with the mvn versions:set command. Furthermore, a section in the POM file title Aggregation (or Multi-Module) <https://maven.apache.org/pom.html#aggregation-or-multi-module> seems to provide some insight into what's going on, but my inferences might be incorrect about versions needing to be consistent based on the content in that section. So, what is the official practice for versions of sub-modules in a multi-module project? Should all versions be the same as the version in the parent POM? If it's acceptable for sub-module versions to be different, how does one accomplish stripping -SNAPSHOT from all modules (preferably with a Maven plugin versus running commands to iterate over all sub-directories to find child POMs and drop -SNAPSHOT from each)? Thank you. Mike --- I am working on a multi-module project. For the purposes of this exercise we can assume there are two sub-modules. The articles Maven Simple Project Archetype <https://maven.apache.org/archetypes/maven-archetype-simple/> and Create an archetype from a multi-module project <https://maven.apache.org/archetype/maven-archetype-plugin/examples/create-multi-module-project.html> can be referenced to follow along. Parent - 1.0.0-SNAPSHOT ChildA - 1.2.3-SNAPSHOT ChildB - 1.0.0-SNAPSHOT When I run mvn versions:set -D removeSnapshot -D processAllModules I expect the versions to change as indicated below. Parent - 1.0.0 ChildA - 1.2.3 ChildB - 1.0.0 But, it seems -SNAPSHOT is stripped from all versions except the children that have a different version from the parent. Parent - 1.0.0 ChildA - 1.2.3-SNAPSHOT ChildB - 1.0.0 Is there any way to run the mvn versions:set command to honor the version number, while stripping the -SNAPSHOT postfix? -- *UPDATE #1* Running mvn versions:set -D removeSnapshot=true yields the same results as running mvn versions:set -D removeSnapshot -D processAllModules. Parent - 1.0.0 ChildA - 1.2.3-SNAPSHOT ChildB - 1.0.0