Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.3.9
-
None
-
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: C:\Temp\apache-maven-3.3.9
Java version: 1.8.0_66, vendor: Oracle Corporation
Java home: C:\Prog\Java\v8_66\jre
Default locale: nl_NL, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00) Maven home: C:\Temp\apache-maven-3.3.9 Java version: 1.8.0_66, vendor: Oracle Corporation Java home: C:\Prog\Java\v8_66\jre Default locale: nl_NL, platform encoding: Cp1252 OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
Description
Run 'mvn package' on the project in the attached Parent.zip. Note that the dependency Jar2 gets packaged in WEB-INF/lib and the other dependencies (Jar, Jar1 and Jar3) do not.
I think the inclusion of Jar2 is incorrect, because project 'Web' declares its dependency on 'Jar' to be optional and Jar2 being a transitive dependency of Jar should inherit this.
If you look at the other Jarx dependencies, they have different combinations of ways to become optional and have their versions managed. Only the case when optionality is inherited and the dependency management for the version is in another pom, yields incorrect results.
Please note that I believe the maven-war-plugin is not the cause of this behavior. I have built and used a modified version of maven-war-plugin which as the first thing in its WarMojo.execute() lists the result of getProject().getArtifacts() including the value of each Artifact's isOptional() method. Already at this point only Jar2 has optional false.
I am using maven-war-plugin in this bug report for the following reasons:
- maven-war-plugin uses the optional flag of dependencies in deciding whether to package it or not, making this behavior visible
- I don't know of another way to visualize the value of the optional flag in core maven (running with -X outputs the dependency tree in a section with header 'Dependency collection stats', but this only shows the scope value)
- maven-dependency-plugin:resolve also only shows scope and not optionality
- obviously, maven-war-plugin is exactly what I intend to use and where I found the bug
Attachments
Attachments
Issue Links
- depends upon
-
MNG-5227 The 'optional' flag of a dependency should be manageable.
- Reopened
- is blocked by
-
MRESOLVER-9 DefaultDependencyCollector does not correctly handle dependency management
- Reopened
- is related to
-
MNG-5273 Transitive dependencies with scope provided ending up in the final artifact
- Closed
-
MSHARED-437 maven-dependency-tree removes optional flag from managed dependencies
- Closed
-
MNG-6228 Optionality not displayed in dependency tree when run in debug mode
- Closed
- is required by
-
MNG-6139 Addition of command line option 'legacy-dependency-management'.
- Closed
- requires
-
MNG-6229 Write out optionality in Core IT Plugins for collection and resolution
- Closed
- mentioned in
-
Page Loading...