releases module with fixed dependency version
I am testing this plugin to see if it fits my organization.
One of my tests consists of a module2 with a dependency on module1, but with a fixed version
module2/pom.xml
<dependency>
<groupId>org.example</groupId>
<artifactId>module1</artifactId>
<version>1.6.0</version>
<scope>compile</scope>
</dependency>
parent pom.xml
<build>
<plugins>
<plugin>
<groupId>com.github.danielflower.mavenplugins</groupId>
<artifactId>multi-module-maven-release-plugin</artifactId>
<version>3.6.4</version>
<configuration>
<noChangesAction>ReleaseNone</noChangesAction>
</configuration>
</plugin>
</plugins>
</build>
After changing something on module1 and committing, multi-module-maven-release-plugin tries to also release module2
❯ mvn releaser:next
Unable to find the root directory. Create a .mvn directory in the root directory or add the root="true" attribute on the root project's model to identify it.
[INFO] Scanning for projects...
[INFO] --------------------------------------------------------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] maven-multimodule-relase-demo [pom]
[INFO] module1 [jar]
[INFO] module2 [jar]
[INFO]
[INFO] --------------------------------------< org.example:maven-multimodule-relase-demo >---------------------------------------
[INFO] Building maven-multimodule-relase-demo 1.6-SNAPSHOT [1/3]
[INFO] from pom.xml
[INFO] ---------------------------------------------------------[ pom ]----------------------------------------------------------
[INFO]
[INFO] --- releaser:3.6.4:next (default-cli) @ maven-multimodule-relase-demo ---
[INFO] Will use version 1.6.0 for maven-multimodule-relase-demo as it has not been changed since that release.
[INFO] Will use version 2.1.2 for module1 as it has changed since the last release.
[INFO] Releasing module2 1.6.3 as module1 has changed.
[INFO] Copying org.example:maven-multimodule-relase-demo:pom:1.6-SNAPSHOT to project local repository
[INFO] Copying org.example:maven-multimodule-relase-demo:pom:consumer:1.6-SNAPSHOT to project local repository
[INFO] --------------------------------------------------------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] maven-multimodule-relase-demo 1.6-SNAPSHOT ........................................................... SUCCESS [ 0.387 s]
[INFO] module1 2.1-SNAPSHOT ................................................................................. SKIPPED
[INFO] module2 1.6-SNAPSHOT ................................................................................. SKIPPED
[INFO] --------------------------------------------------------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] --------------------------------------------------------------------------------------------------------------------------
[INFO] Total time: 0.531 s
[INFO] Finished at: 2023-07-20T17:19:36+01:00
Is this intentional behavior ? I do not think it should publish module2.
module1 is part of the same project, since it was modified, it will be rebuilt and generate a new jar. Since you are running a multi-module maven project, the reactor will build module1 and its downstream dependencies (all modules dependent on module1) and release module2.
Notice that the multi-module maven release plugin doesn't run a deep check of the code changed but instead checks module folder level comparison between two git commits.
Since you are running a multi-module maven project, the reactor will build module1 and its downstream dependencies (all modules dependent on module1) and release module2.
Are you talking about the Maven reactor or the multi-module-maven-release-plugin reactor ?
Maven will not rebuild module2 in this scenario.
I misunderstood the use case, I think I get it now, you are using a real version of a dependency which is part of the project
I believe the root cause for this issue is in this line where it compares group+artifact id of an already released module (module1) from current module2 dependencies, but version is ignored (I believe the assumption was that the -SNAPSHOT is always used for local dependencies).
So, eventually, the plugin releases module2 as well since it sees module1 as a changed dependency.