qoomon / maven-git-versioning-extension

This extension will set project version, based on current Git branch or tag.
GNU General Public License v3.0
306 stars 87 forks source link

[v9.7.0] Missing transitive dependencies in multi-module project when modules are excluded and resolved version is 0.0.0-SNAPSHOT #292

Open wacker opened 8 months ago

wacker commented 8 months ago

Version: 9.7.0

Given a multi-module Maven project maven-versioning-test with parent and two modules a and b where b depends on a.

An initial git tag v0.0.0 is set on master and there are some changes in a branch, so this ref matches:

<ref type="branch">
  <describeTagPattern><![CDATA[^v(?<name>[0-9]+\.[0-9]+\.[0-9]+)$]]></describeTagPattern>
  <version>${describe.tag.name}-SNAPSHOT</version>
</ref>

and -- as expected -- results in version = 0.0.0-SNAPSHOT.

Now trying to compile the project without module a (so it should be read from the local repository).

mvn compile --projects '!a'

causes missing transitive dependencies:

[INFO] maven-versioning-test:a
[WARNING] The POM for maven-versioning-test:a:jar:0.0.0-SNAPSHOT is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details

Adding -X reveals more detail:

[INFO] maven-versioning-test:a
[DEBUG] set parent version to 0.0.0-SNAPSHOT (maven-versioning-test:parent:0.0.0-SNAPSHOT)
[DEBUG] generate /home/user/.m2/repository/maven-versioning-test/a/0.0.0-SNAPSHOT/.git-versioned-pom.xml
[WARNING] The POM for maven-versioning-test:a:jar:0.0.0-SNAPSHOT is invalid, transitive dependencies (if any) will not be available: 1 problem was encountered while building the effective model
[FATAL] Non-readable POM /home/user/.m2/repository/maven-versioning-test/a/0.0.0-SNAPSHOT/a-0.0.0-SNAPSHOT.pom: /home/user/.m2/repository/maven-versioning-test/a/0.0.0-SNAPSHOT/pom.xml @ 

There should be no attempt to read pom.xml from or create .git-versioned-pom.xml inside the local repository.

This behavior could not be observed in the previous version 9.6.6 and therefore is probably related to