Maven 2 & 3

Optional tag in dependencyManagement is not inherited in the children projects

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.0
  • Fix Version/s: 2.0.1
  • Component/s: Plugins and Lifecycle
  • Labels:
    None
  • Complexity:
    Intermediate
  • Testcase included:
    yes
  • Number of attachments :
    3

Description

If I put this in the parent pom, all the subprojects should inherit the optional tag (and be able to override it)

<dependencyManagement>
<dependencies>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.1_2</version>
<optional>true</optional>
</dependency>
</dependencies>
</dependencyManagement>

it test attached

  1. it1020.patch
    19/Nov/05 9:29 PM
    39 kB
    Carlos Sanchez
  2. MNG-1630-maven-artifact.patch
    25/Nov/05 2:01 AM
    2 kB
    Edwin Punzalan
  3. MNG-1630-maven-project.patch
    25/Nov/05 3:50 AM
    1 kB
    Edwin Punzalan

Issue Links

Activity

Hide
Edwin Punzalan added a comment -

Please see attached patch...

Show
Edwin Punzalan added a comment - Please see attached patch...
Hide
John Casey added a comment -

Applied patches, with minor changes.

These patches will ensure that the optional flag is passed on and inherited correctly when dealing with managed dependencies.

I changed the patches, in that I added a new createDependencyArtifact(..) method on ArtifactFactory, which will eliminate the need to call an older variant of the method by passing in a null value for the inheritedScope parameter.

Show
John Casey added a comment - Applied patches, with minor changes. These patches will ensure that the optional flag is passed on and inherited correctly when dealing with managed dependencies. I changed the patches, in that I added a new createDependencyArtifact(..) method on ArtifactFactory, which will eliminate the need to call an older variant of the method by passing in a null value for the inheritedScope parameter.
Hide
jh added a comment -

I'm working with maven version 2.0.7 and am experiencing the same problem as mentioned here.

I've defined a dependency as optional in the management part of a parent pom but the child pom doesn't state that dependency as optional. I can verify this with eg the help:effective-pom which shows a difference in the dependencies and dependencyManagement elements (only the latter contains the optional tag).

Is this bug popping up again??

Show
jh added a comment - I'm working with maven version 2.0.7 and am experiencing the same problem as mentioned here. I've defined a dependency as optional in the management part of a parent pom but the child pom doesn't state that dependency as optional. I can verify this with eg the help:effective-pom which shows a difference in the dependencies and dependencyManagement elements (only the latter contains the optional tag). Is this bug popping up again??
Hide
Benjamin Bentmann added a comment -

Actually, this issue was never fixed. The changes that have been committed in r354544 are insufficient as they neither update the DefaultArtifactCollector nor the DefaultModelDefaultsInjector to propage the optional flag from a managed dependency/artifact to a project dependency.

Show
Benjamin Bentmann added a comment - Actually, this issue was never fixed. The changes that have been committed in r354544 are insufficient as they neither update the DefaultArtifactCollector nor the DefaultModelDefaultsInjector to propage the optional flag from a managed dependency/artifact to a project dependency.

People

Vote (0)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: