Maven 2 & 3

inherited plugin dependencies

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: 2.0
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Complexity:
    Intermediate
  • Number of attachments :
    0

Description

I have project composed of a reactor/parent pom.xml and a few module.

In the parent pom.xml, I have somthing like this :

<plugins>
....
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<!-- The assembly plugin is not flexible enought for what we have to do -->
<phase>package</phase>
<configuration>
<tasks>
<property name="version.number" value="${project.version}"/>
<ant antfile="src/build/build.xml" inheritRefs="true"/>
</tasks>
</configuration>
<goals><goal>run</goal></goals>
</execution>
</executions>
<inherited>false</inherited>
</plugin>
...
</plugins>

In one of the module, I have

<plugins>
...
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>generate-test-sources</phase>
<configuration>
<tasks>
<ant antfile="src/test/ant/build.xml" inheritRefs="true"/>
</tasks>
<testSourceRoot>target/generated-sources/nextmock</testSourceRoot>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<!-- Required to use javac -->
<groupId>sun.jdk</groupId>
<artifactId>tools</artifactId>
<version>1.5</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
</dependencies>
</plugin>
...
</plugins>

It seems that the dependencies is in the sub-module is not loaded, probably because the plugin is loaded in the parent pom (or in the reactor pom which is the same in many cases) and not updated afterward.

The simple work around is to place the dependencies into the reactor plugin declaration. (A strange thing is that the dependecy doesn't need to be present in the module declaration anymore in that case)

I tried also to place it only int the pluginManagment section but it doesn't work. The dependency is not loaded.

Issue Links

Activity

Hide
Gilles Scokart added a comment -

Sory Carlos, but I don't see the relation with MANTRUN-37.

The issue raised here is: when a parent project use a plugin without specifying dependencies, the submodules can not add dependencies to this plusgin. I detected it with antrun, but I guess it is exactly the same with other plugins.

I retested it with maven 2.0.2 and it is still failing.

I also have to add that it only fails when we launch the build from the parent project. If you launch the build in the child project, the dependencies are correctly loaded.

Show
Gilles Scokart added a comment - Sory Carlos, but I don't see the relation with MANTRUN-37. The issue raised here is: when a parent project use a plugin without specifying dependencies, the submodules can not add dependencies to this plusgin. I detected it with antrun, but I guess it is exactly the same with other plugins. I retested it with maven 2.0.2 and it is still failing. I also have to add that it only fails when we launch the build from the parent project. If you launch the build in the child project, the dependencies are correctly loaded.
Hide
Carlos Sanchez added a comment -

It duplicates that and the related issues, they are caused by the same problem

Show
Carlos Sanchez added a comment - It duplicates that and the related issues, they are caused by the same problem
Hide
Gilles Scokart added a comment -

I retested this case on 2.0.3 and it has changed.

It seems that now, when you invoke a plugin without extension in the root project and invoke the same plugin with extensions a sub-project , the extensions are loaded into the subproject plugin.

However, the root plugin is inerited by all submodule (executed in each submodule) except in the child plugin who use the same plugin. In this child plugin, the plugin is invoked twice.

Show
Gilles Scokart added a comment - I retested this case on 2.0.3 and it has changed. It seems that now, when you invoke a plugin without extension in the root project and invoke the same plugin with extensions a sub-project , the extensions are loaded into the subproject plugin. However, the root plugin is inerited by all submodule (executed in each submodule) except in the child plugin who use the same plugin. In this child plugin, the plugin is invoked twice.
Hide
Carlos Sanchez added a comment -

This issue was closed as duplicate, please leave your comments in MNG-1949

Show
Carlos Sanchez added a comment - This issue was closed as duplicate, please leave your comments in MNG-1949

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: