Mojo's Versions Maven Plugin
  1. Mojo's Versions Maven Plugin
  2. MVERSIONS-69

display-plugin-updates: No warning for build.plugins.plugin without version specified

    Details

    • Type: Bug Bug
    • Status: Reopened Reopened
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.0
    • Fix Version/s: Backlog
    • Labels:
      None
    • Environment:
      Maven 2.2.1
    • Testcase included:
      yes
    • Number of attachments :
      1

      Description

      Given the following POM:

      <?xml version="1.0" encoding="UTF-8"?>
      <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/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
      
        <groupId>foo</groupId>
        <artifactId>bar</artifactId>
        <version>1.0-SNAPSHOT</version>
      
        <build>
          <plugins>
            <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>build-helper-maven-plugin</artifactId>
            </plugin>
          </plugins>
        </build>
      </project>
      

      When running mvn versions:display-plugin-updates, I would expect to get a warning about the build-helper-maven-plugin not having its version specified, but it's not the case:

      [INFO] Scanning for projects...
      [INFO] Searching repository for plugin with prefix: 'versions'.
      [INFO] ------------------------------------------------------------------------
      [INFO] Building Unnamed - foo:bar:jar:1.0-SNAPSHOT
      [INFO]    task-segment: [versions:display-plugin-updates]
      [INFO] ------------------------------------------------------------------------
      [INFO] [versions:display-plugin-updates {execution: default-cli}]
      [INFO] 
      [INFO] The following plugin updates are available:
      [INFO]   maven-clean-plugin ....................................... 2.2 -> 2.3
      [INFO]   maven-install-plugin ..................................... 2.2 -> 2.3
      [INFO]   maven-resources-plugin ................................... 2.3 -> 2.4
      [INFO]   maven-site-plugin ............................... 2.0-beta-7 -> 2.0.1
      [INFO] 
      [WARNING] The following plugins do not have their version specified:
      [WARNING]   maven-clean-plugin .......................... (from super-pom) 2.3
      [WARNING]   maven-compiler-plugin ..................... (from super-pom) 2.0.2
      [WARNING]   maven-deploy-plugin ......................... (from super-pom) 2.4
      [WARNING]   maven-install-plugin ........................ (from super-pom) 2.3
      [WARNING]   maven-jar-plugin ............................ (from super-pom) 2.2
      [WARNING]   maven-resources-plugin ...................... (from super-pom) 2.4
      [WARNING]   maven-site-plugin ......................... (from super-pom) 2.0.1
      [WARNING]   maven-surefire-plugin ..................... (from super-pom) 2.4.3
      [INFO] 
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESSFUL
      [INFO] ------------------------------------------------------------------------
      

        Activity

        Hide
        Pablo added a comment -

        Here you are: exactly the same test as it-display-plugin-updates-005, but with the short command line (as described in the plugin's doc).

        It fails on my machine.
        Thanks for giving it a try on yours!

        Show
        Pablo added a comment - Here you are: exactly the same test as it-display-plugin-updates-005 , but with the short command line (as described in the plugin's doc). It fails on my machine. Thanks for giving it a try on yours!
        Hide
        Stephen Connolly added a comment -

        OK confirmed as a real bug.... probably an issue in core... I'll see if I can find a hackaround

        Show
        Stephen Connolly added a comment - OK confirmed as a real bug.... probably an issue in core... I'll see if I can find a hackaround
        Hide
        Stephen Connolly added a comment -

        The issue seems to be how plugins get bound to the lifecycle...

        for it-___-005 we get

        [INFO] [DEBUG] after adding local pluginManagement
        [INFO] org.apache.maven.plugins:maven-clean-plugin:2.2
        [INFO] org.apache.maven.plugins:maven-deploy-plugin:2.3
        [INFO] org.apache.maven.plugins:maven-install-plugin:2.2
        [INFO] org.apache.maven.plugins:maven-site-plugin:2.0
        [INFO] [DEBUG] after adding lifecycle plugins
        [INFO] localhost:dummy-maven-plugin:null
        [INFO] org.apache.maven.plugins:maven-clean-plugin:2.2
        [INFO] org.apache.maven.plugins:maven-deploy-plugin:2.3
        [INFO] org.apache.maven.plugins:maven-install-plugin:2.2
        [INFO] org.apache.maven.plugins:maven-site-plugin:2.0
        [INFO] org.codehaus.mojo:versions-maven-plugin:1.1-SNAPSHOT

        while for it-___-006 we get

        [INFO] [DEBUG] after adding local pluginManagement
        [INFO] org.apache.maven.plugins:maven-clean-plugin:2.2
        [INFO] org.apache.maven.plugins:maven-deploy-plugin:2.3
        [INFO] org.apache.maven.plugins:maven-install-plugin:2.2
        [INFO] org.apache.maven.plugins:maven-site-plugin:2.0
        [INFO] [DEBUG] after adding lifecycle plugins
        [INFO] localhost:dummy-maven-plugin:3.0
        [INFO] org.apache.maven.plugins:maven-clean-plugin:2.2
        [INFO] org.apache.maven.plugins:maven-deploy-plugin:2.3
        [INFO] org.apache.maven.plugins:maven-install-plugin:2.2
        [INFO] org.apache.maven.plugins:maven-site-plugin:2.0
        [INFO] org.codehaus.mojo:versions-maven-plugin:1.1-SNAPSHOT

        so it seems that when you invoke a build with a partially qualified plugin (e.g. versions:display-plugin-updates), maven needs to evaluate the project lifecycle to see if any of the bound plugins provide the goal, which requires resolving the plugin versions.

        if you invoke a build with a fully qualified plugin, maven does not have to evaluate the project lifecycle, and so we still do not know the version... I'll have to see how we can fix this... short of dancing up the tree parsing the raw model I am not sure there is an easy solution

        Show
        Stephen Connolly added a comment - The issue seems to be how plugins get bound to the lifecycle... for it-___-005 we get [INFO] [DEBUG] after adding local pluginManagement [INFO] org.apache.maven.plugins:maven-clean-plugin:2.2 [INFO] org.apache.maven.plugins:maven-deploy-plugin:2.3 [INFO] org.apache.maven.plugins:maven-install-plugin:2.2 [INFO] org.apache.maven.plugins:maven-site-plugin:2.0 [INFO] [DEBUG] after adding lifecycle plugins [INFO] localhost:dummy-maven-plugin:null [INFO] org.apache.maven.plugins:maven-clean-plugin:2.2 [INFO] org.apache.maven.plugins:maven-deploy-plugin:2.3 [INFO] org.apache.maven.plugins:maven-install-plugin:2.2 [INFO] org.apache.maven.plugins:maven-site-plugin:2.0 [INFO] org.codehaus.mojo:versions-maven-plugin:1.1-SNAPSHOT while for it-___-006 we get [INFO] [DEBUG] after adding local pluginManagement [INFO] org.apache.maven.plugins:maven-clean-plugin:2.2 [INFO] org.apache.maven.plugins:maven-deploy-plugin:2.3 [INFO] org.apache.maven.plugins:maven-install-plugin:2.2 [INFO] org.apache.maven.plugins:maven-site-plugin:2.0 [INFO] [DEBUG] after adding lifecycle plugins [INFO] localhost:dummy-maven-plugin:3.0 [INFO] org.apache.maven.plugins:maven-clean-plugin:2.2 [INFO] org.apache.maven.plugins:maven-deploy-plugin:2.3 [INFO] org.apache.maven.plugins:maven-install-plugin:2.2 [INFO] org.apache.maven.plugins:maven-site-plugin:2.0 [INFO] org.codehaus.mojo:versions-maven-plugin:1.1-SNAPSHOT so it seems that when you invoke a build with a partially qualified plugin (e.g. versions:display-plugin-updates), maven needs to evaluate the project lifecycle to see if any of the bound plugins provide the goal, which requires resolving the plugin versions. if you invoke a build with a fully qualified plugin, maven does not have to evaluate the project lifecycle, and so we still do not know the version... I'll have to see how we can fix this... short of dancing up the tree parsing the raw model I am not sure there is an easy solution
        Hide
        Stephen Connolly added a comment -

        Supplied testcase added to SVN in r11844

        Show
        Stephen Connolly added a comment - Supplied testcase added to SVN in r11844
        Hide
        Stephen Connolly added a comment -

        Not sure when we can target a fix for this issue

        Show
        Stephen Connolly added a comment - Not sure when we can target a fix for this issue

          People

          • Assignee:
            Stephen Connolly
            Reporter:
            Pablo
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: