Hi guys,
I have a simple use case:
my-project that has
my-project-parent @ 1.8.0, the latest release version in the repository w/ releases. In the repository w/ snapshots, there are several newer versions, e.g.
1.9.0-SNAPSHOT,
1.10.0-SNAPSHOT.
I run "mvn versions:update-parent -DallowSnapshots=true", and I would expect a version update of my-project-parent, from 1.8.0 -> 1.10.0-SNAPSHOT. And this doesn't happen.
1) I ran the same command w/ -X, and I observed:
[DEBUG] Skipping update check for artifact ...my-project-parent (...m2\repository\...\my-project-parent\maven-metadata-...-snapshots.xml) from disabled repository ...-snapshots (http:/...). This seemed related to the issue. The mojo should have looked there to find the new versions, but it doesn't even try.
2) Debug through code:
Lanucher.main() calls
... calls
[1] UpdateParentMojo.findLatestVersion(...) calls
... calls
[2] DefaultMetadataSource.resolve(...) calls
[3] ArtifactRepositoryMetadata.getPolicy(...)
[3] is invoked having "...-snapshots repo" as parameter; but returns systematically the policy repository.getReleases(). Because of this,
[2], when doing policy.isEnabled() => false. Thus the debug message from 1). We should note that a bunch of classes, included
[2] and
[3] have 2 implementations. One from the MVN install dir, e.g. maven-compat-3.3.3.jar, and one from the mvn repo, e.g. maven-artifact-manager-2.2.1. The first one is used, from the maven dir.
So,
[1] receives a list of versions, EXCLUDING the new snapshot versions. And after this point, the parameter passed from command line, i.e. "allowSnapshots=true" is taken into account. But at this point, the interesting versions are not known, so in my opinion, this parameter cannot have any effect.
It must be something that I miss; because by looking at the current code & flow, I don't see how this simple, i.e. using "allowSnapshots=true" use case would work.
Do you have any hints for me please?
Thanks a lot in advance,
Cristian.