mojohaus / flatten-maven-plugin

Flatten Maven Plugin
https://www.mojohaus.org/flatten-maven-plugin/
Apache License 2.0
201 stars 85 forks source link

Regression in full flattening with some dependencies #408

Open harrisric opened 6 months ago

harrisric commented 6 months ago

In using flatten:flatten I have found a change in behaviour between 1.3.0 and 1.6.0. Specifically I think that the change is in 1.4.0 as this is the first version at which it fails. When using flattenDependencyMode=all the plugin seems to try and resolve dependencies parents and now fail if they cannot be fully resolved.

This is reproduced in the simple example project pom attached by calling mvn flatten:flatten pom.xml.txt

The problem as I understand it is that we have a dependency chain: com.querydsl:querydsl-core:4.3.1 -> com.infradna.tool:bridge-method-annotation:jar:1.13 -> exclusion: org.jenkins-ci:annotation-indexer:jar:1.4

but that org.jenkins-ci:annotation-indexer:jar:1.4 references an unpublished parent project org.jenkins-ci:jenkins:pom:1.26 which therefore cannot be resolved.

If there is a way to avoid this parent resolution or suppress the failure then that would be helpful as the behaviour at 1.3.0 of flatten-maven-plugin seemed to be sufficient in this use-case.

harrisric commented 5 months ago

The problem appears to originate here: https://github.com/mojohaus/flatten-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/flatten/FlattenMojo.java#L1097 This appears to try and resolve the excluded dependency, which leads to the problem in finding its parent.

In the 1.3.0 the dependency in the exclusion block is never resolved.