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
>
>

Reply via email to