versions icon indicating copy to clipboard operation
versions copied to clipboard

versions:display-plugin-updates doesn't take parent pom build.plugins.plugin versions into account

Open jonenst opened this issue 8 years ago • 7 comments

I have a structure: parent/pom.xml parent/child/pom.xml

When a plugin in the parent version is not in the build.pluginManagement.plugins.plugin element, it is not picked up by version:display-plugin-updates in the child.

tested with maven 3.0.5 and 3.3.9; maven-versions-plugin 3.0.0, 3.0.1, 3.0.2

How is this supposed to be used ?

For example:
good/parent/pom.xml:

<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>foo</groupId>
  <artifactId>parent</artifactId>
  <name>parent pom</name>
  <packaging>pom</packaging>
  <version>1.0.0</version>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-clean-plugin</artifactId>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>3.0.0</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  <prerequisites>
    <maven>3.0.5</maven>
  </prerequisites>
</project>

good/parent/child/pom.xml

<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>foo</groupId>
  <artifactId>child</artifactId>
  <name>child pom</name>
  <packaging>pom</packaging>
  <version>1.0.0</version>
  <parent>
    <groupId>foo</groupId>
    <artifactId>parent</artifactId>
    <version>1.0.0</version>
  </parent>
</project>

$ mvn versions:display-plugin-updates

[INFO] --- versions-maven-plugin:2.3:display-plugin-updates (default-cli) @ child ---
[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]   maven-deploy-plugin ....................... (from super-pom) 2.8.2
[WARNING]   maven-install-plugin ...................... (from super-pom) 2.5.2
[WARNING]   maven-site-plugin ........................... (from super-pom) 3.6

Compare with: bad/parent/pom.xml:

<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>foo</groupId>
  <artifactId>parent</artifactId>
  <name>parent pom</name>
  <packaging>pom</packaging>
  <version>1.0.0</version>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-clean-plugin</artifactId>
        <version>3.0.0</version>
      </plugin>
    </plugins>
  </build>
  <prerequisites>
    <maven>3.0.5</maven>
  </prerequisites>
</project>

bad/parent/child/pom.xml is the same as good/parent/child/pom.xml

$ mvn versions:display-plugin-updates

[INFO] --- versions-maven-plugin:2.3:display-plugin-updates (default-cli) @ child ---
[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]   maven-clean-plugin ........................ (from super-pom) 3.0.0
[WARNING]   maven-deploy-plugin ....................... (from super-pom) 2.8.2
[WARNING]   maven-install-plugin ...................... (from super-pom) 2.5.2
[WARNING]   maven-site-plugin ........................... (from super-pom) 3.6

jonenst avatar Feb 16 '17 16:02 jonenst

First I would say not defining plugin versions in pluginManagement is not the best but on the other hand this could be improved ...

khmarbaise avatar Feb 26 '17 15:02 khmarbaise

Similar situation here: parent (external) defines a plugin in pluginMgt with version and some config project parent defines the plugin in pluginMgt w/o version and alternate config child uses plugin w/o version

While effective pom of child shows proper/expected version, the mojo reports the plugin as having "unspecified" version, which IMO is wrong.

Is it recommendation, to not have pluginMgt entry without version, even if parent has it w/ version?

cstamas avatar May 05 '17 07:05 cstamas

I have basically the same issue, and a second related issue. The parent pom specifies a plugin in plugins (but not pluginManagement) with version.

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-clean-plugin</artifactId>
				<version>3.0.0</version>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.6.1</version>
                                ...

The project pom does not specify any plugins. The versions plugin does not pick up on the version specs in the build.plugins section, but it should.

$ mvn versions:display-plugin-updates
[INFO] All plugins with a version specified are using the latest versions.
[WARNING] The following plugins do not have their version specified:
[WARNING]   maven-clean-plugin ........................ (from super-pom) 3.0.0
[WARNING]   maven-compiler-plugin ..................... (from super-pom) 3.7.0

If I add the plugin groupId/artifactId/version in pluginManagement,

	<build>
		<pluginManagement>
			<plugins>
                                <plugin>
                                        <groupId>org.apache.maven.plugins</groupId>
                                        <artifactId>maven-clean-plugin</artifactId>
                                        <version>3.0.0</version>
                                </plugin>
                                <plugin>
                                        <groupId>org.apache.maven.plugins</groupId>
                                        <artifactId>maven-compiler-plugin</artifactId>
                                        <version>3.6.1</version>
                                </plugin>

I don't get the warnings about the compiler and clean plugins. So the versions plugin is not paying attention to the build.plugins section, only to the build.pluginManagement.plugins section, which seems like a clear bug.

The second issue is that after the change, the versions plugin is still saying

[INFO] All plugins with a version specified are using the latest versions.

even though the compiler plugin is not specifying the latest version, 3.6.1 vs 3.7.0. This also seems like a clear bug.

rvsasseen avatar Jun 19 '18 18:06 rvsasseen

Please reopen this issue. This is clearly a bug.

Furthermore, there is no way to determine outdated plugins that are specified in pluginManagement whatsoever with the versions plugin

lprimak avatar Jan 01 '22 05:01 lprimak

Agree. The issue is called stale, but it should be easy enough for the development team to verify whether it still exists, and if people are still commenting on it, presumably it does. One would think it wouldn't be that hard to fix. Maybe it's not considered a high priority, but why not leave it open until the team can eventually get to it?


From: Lenny Primak @.> Sent: Friday, December 31, 2021 9:42 PM To: mojohaus/versions-maven-plugin @.> Cc: rvsasseen @.>; Comment @.> Subject: Re: [mojohaus/versions-maven-plugin] versions:display-plugin-updates doesn't take parent pom build.plugins.plugin versions into account (#131)

Please reopen this issue. This is clearly a bug.

Furthermore, there is no way to determine outdated plugins that are specified in pluginManagement whatsoever with the versions plugin

— Reply to this email directly, view it on GitHubhttps://github.com/mojohaus/versions-maven-plugin/issues/131#issuecomment-1003509795, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA7YOXBWF52BMKK767OP5FTUT2H3PANCNFSM4DANAGWA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you commented.Message ID: @.***>

rvsasseen avatar Jan 01 '22 07:01 rvsasseen

i assume this is a duplicate of #550, #562 is my proposal to fix the issue see also https://github.com/mojohaus/versions-maven-plugin/issues/550#issuecomment-1043068835 about my rationale for the fix

stefanseifert avatar Feb 17 '22 15:02 stefanseifert

This is most likely not a duplicate but a separate issue @stefanseifert However I am not 100% sure of that, so this issue should stay open until it's proven to be duplicate

lprimak avatar Feb 17 '22 20:02 lprimak

I've been trawling through the oldest bugs trying to fix them. However, I'm unable to reproduce this one, even with version 2.3 of the plugin. @lprimak could you please provide steps to reproduce it if you believe it should still be open?

E.g. on version 2.3:

The following plugin updates are available:
  maven-clean-plugin ................................... 3.0.0 -> 3.1.0


Project defines minimum Maven version as: 3.0.5
Plugins require minimum Maven version of: 3.2.5
Note: the super-pom from Maven 3.8.6 defines some of the plugin
      versions and may be influencing the plugins required minimum Maven
      version.

> Project requires an incorrect minimum version of Maven.
> Either change plugin versions to those compatible with 3.0.5
> or update the pom.xml to contain
>     <prerequisites>
>       <maven>3.2.5</maven>
>     </prerequisites>

Require Maven 3.2.5 to use the following plugin updates:
  maven-clean-plugin ............................................ 3.2.0
  maven-deploy-plugin ........................................... 3.0.0
  maven-install-plugin .......................................... 3.0.1
  maven-site-plugin .......................................... 4.0.0-M3

jarmoniuk avatar Oct 07 '22 05:10 jarmoniuk

Tried to reproduce with 2.11 (latest maven) and the issue looks to be fixed. thank you! @ajarmoniuk

lprimak avatar Oct 07 '22 18:10 lprimak

@slachiewicz can be closed

jarmoniuk avatar Oct 07 '22 18:10 jarmoniuk