Here is the POM:

<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>z</groupId>
  <artifactId>ztest</artifactId>
  <version>0.1-SNAPSHOT</version>
  <packaging>pom</packaging>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>2.10</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

</project>

With JDK 6 on my box, I am using Maven 3.1.1.

Running this:
mvn -X org.apache.maven.plugins:maven-dependency-plugin:tree

I get this:
[DEBUG] Configuring mojo
'org.apache.maven.plugins:maven-dependency-plugin:2.8:tree' with basic
configurator

It should be 2.10 if the POM was consulted.

PS: I did a little archaeological digging. Evidently, the Super POM for
3.1.1 locks the Dependency Plugin to 2.8 [1], which explains why 2.8 is
being selected. There is also this curious comment in there (and still
exists in 3.3.9):
<!-- They are kept for the moment as they are very unlikely to conflict
with lifecycle mappings (MNG-4453) -->

It seems to me this is a bug: the Super POM is being preferred over the
Plugin Management of my POM.

[1] https://maven.apache.org/ref/3.1.1/maven-model-builder/super-pom.html

Cheers,
Paul

On Thu, Dec 10, 2015 at 7:25 AM, Adrien Rivard <[email protected]>
wrote:

> Hi,
>
> It works correctly for me, tested with :
>
>   <build>
> <pluginManagement>
> <plugins>
> <plugin>
> <groupId>org.codehaus.mojo</groupId>
> <artifactId>versions-maven-plugin</artifactId>
> <version>2.1</version>
> </plugin>
> </plugins>
> </pluginManagement>
> </build>
>
>
> and "mvn
> org.codehaus.mojo:versions-maven-plugin:display-dependency-updates"
>
>
> Are you sure you did'nt miss something ? like wrong artifactId/groupId
> maybe ?
>
>
>
> On Wed, Dec 9, 2015 at 9:41 PM, Paul Benedict <[email protected]>
> wrote:
>
> > groupId:artifactId:goal
> >
> > Cheers,
> > Paul
> >
> > On Wed, Dec 9, 2015 at 2:38 PM, Robert Scholte <[email protected]>
> > wrote:
> >
> > > I'd say bug. Are you using prefix:goal or groupId:artifactId:goal ?
> > >
> > > Robert
> > >
> > > Op Wed, 09 Dec 2015 17:19:32 +0100 schreef Paul Benedict <
> > > [email protected]>:
> > >
> > >
> > > Scenario: I executed a plugin goal on command line and specified a
> > version
> > >> (1.5). I then did it again without specifying a version. For the
> latter,
> > >> Maven chose the latest version (1.6) from my remote repository.
> > >>
> > >> I was curious about the version selection; so I edited my POM and
> added
> > a
> > >> /build/pluginManagement/plugin to lock down the version. When I
> executed
> > >> without the version on the command line again, the latest (1.6) was
> > still
> > >> selected.
> > >>
> > >> Don't you think that when I omit the version on the command line, if
> the
> > >> plugin version is specified in the POM, it should use the
> configuration?
> > >> Is
> > >> this a bug or an intended feature? It's at least very surprising.
> > >>
> > >> I need to execute a particular version of a plugin in a shell script,
> > but
> > >> I
> > >> don't want to specify the version in the script. I'd rather have it
> > locked
> > >> in the POM but obviously the POM is not consulted in this case. WDYT?
> > >>
> > >> Cheers,
> > >> Paul
> > >>
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [email protected]
> > > For additional commands, e-mail: [email protected]
> > >
> > >
> >
>
>
>
> --
> Adrien Rivard
>

Reply via email to