mojohaus / versions

Versions Maven Plugin
https://www.mojohaus.org/versions/versions-maven-plugin/
Apache License 2.0
337 stars 267 forks source link

versions:display-extension-updates doesn't work for core extensions #1182

Open theit opened 4 hours ago

theit commented 4 hours ago

According to this comment in PR #908 the versions plugin should be able to discover updates for core extensions defined in .mvn/extensions.xml. At least for me this doesn't work (correctly).

The extensions.xml in one of our projects has the following content:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.1.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.1.0 https://maven.apache.org/xsd/core-extensions-1.1.0.xsd">
        <extension>
                <groupId>me.qoomon</groupId>
                <artifactId>maven-git-versioning-extension</artifactId>
                <version>9.8.1</version>
        </extension>
</extensions>

Executing this command:

$ mvn versions:display-extension-updates
[INFO] Scanning for projects...
[INFO]
[INFO] --- me.qoomon:maven-git-versioning-extension:9.8.1 [core extension] ----
[INFO] matching ref: BRANCH - master
[INFO] ref configuration: BRANCH - pattern: .+
[INFO]   describeTagFirstParent: true
[INFO]   version: ${describe.tag}${describe.distance:+-}${describe.distance:-}-g${commit.short}${dirty}
[INFO]   properties:
[INFO]     project.build.outputTimestamp - ${commit.timestamp}
[INFO]
[INFO] com.example:myproject
[INFO] set version to 2.1.0-2-g2b309fb-DIRTY
[INFO]
[INFO]
[INFO] -----------------------< com.example:myproject >------------------------
[INFO] Building myproject 2.1.0-2-g2b309fb-DIRTY
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- versions:2.18.0:display-extension-updates (default-cli) @ myproject ---
[INFO] No extensions have newer versions.
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.479 s
[INFO] Finished at: 2024-11-14T20:40:50+01:00
[INFO] ------------------------------------------------------------------------

I'd assume that I'm being informed there's a newer version 9.10.0 for me.qoomon:maven-git-versioning-extension, but... No.

What puzzles me is that by using the goal display-plugin-updates a warning is printed about a missing version declaration for a plugin that isn't declared in the plugins section of the pom:

$ mvn versions:display-plugin-updates
[INFO] Scanning for projects...
[INFO]
[INFO] --- me.qoomon:maven-git-versioning-extension:9.8.1 [core extension] ----
[INFO] matching ref: BRANCH - master
[INFO] ref configuration: BRANCH - pattern: .+
[INFO]   describeTagFirstParent: true
[INFO]   version: ${describe.tag}${describe.distance:+-}${describe.distance:-}-g${commit.short}${dirty}
[INFO]   properties:
[INFO]     project.build.outputTimestamp - ${commit.timestamp}
[INFO]
[INFO] com.example:myproject
[INFO] set version to 2.1.0-2-g2b309fb-DIRTY
[INFO]
[INFO]
[INFO] -----------------------< com.example:myproject >------------------------
[INFO] Building myproject 2.1.0-2-g2b309fb-DIRTY
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- versions:2.18.0:display-plugin-updates (default-cli) @ myproject ---
[INFO]
[INFO] All plugins with a version specified are using the latest versions.
[INFO]
[WARNING] The following plugins do not have their version specified:
[WARNING]   me.qoomon:maven-git-versioning-extension ................ 9.10.0
[INFO]
[INFO] Project requires minimum Maven version for build of: 3.6.4
[INFO] Plugins require minimum Maven version of: 3.6.4
[INFO]
[INFO] No plugins require a newer version of Maven than specified by the pom.
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.923 s
[INFO] Finished at: 2024-11-14T20:47:51+01:00
[INFO] ------------------------------------------------------------------------

Funny: As you can see in the console output the newest version is now shown...

theit commented 4 hours ago

I forgot to mention that this happens for versions-maven-plugin 2.17.x and the just released 2.18.0, and also for 2.16.x.