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. <version>3.3.0${changelist}</version> 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 <xsl:stylesheet version="2.0" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform"> <xsl:output omit-xml-declaration="no" indent="yes"/> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match="*:project/*:parent/*:version/text()"> <xsl:value-of select="substring-before(., '-SNAPSHOT')"/> </xsl:template> <xsl:template match="*:project/*:version/text()"> <xsl:value-of select="substring-before(., '-SNAPSHOT')"/> </xsl:template> </xsl:stylesheet> On Sat, 2 Apr 2022 at 10:32, Mike Deitrick <mdeitrick1...@gmail.com> wrote: > Any guidance on this matter? > > On Fri, Mar 4, 2022, 7:53 AM Mike Deitrick <mdeitrick1...@gmail.com> > 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 > > > > >