Uploaded image for project: 'Maven Shared Components'
  1. Maven Shared Components
  2. MSHARED-437

maven-dependency-tree removes optional flag from managed dependencies

    XMLWordPrintableJSON

Details

    Description

      Given the following pom the dependency tree looks like this

      • com.mysema.querydsl:querydsl-core:jar:3.4.3:compile
        • com.google.guava:guava:jar:17.0:compile
        • com.google.code.findbugs:jsr305:jar:2.0.3:compile
        • com.mysema.commons:mysema-commons-lang:jar:0.2.4:compile
        • com.infradna.tool:bridge-method-annotation:jar:1.13:compile

      You expect the entire tree to have the optional flag set to true. But sadly that's not the case. com.google.guava:guava and com.google.code.findbugs:jsr305 are optional = false.

      I found that this is because they are managed dependencies (no difference whether imported or declared directly). When I use this pom it works.

      There are some integration tests in this repository that demonstrate the issue. Checkout demonstrate-tree-bug branch and run "mvn verify". Now compare these files in target/it

      • buck-bom-managed-optional-transitive-dependencies/target/BUCK
      • buck-managed-optional-transitive-dependencies/target/BUCK
      • buck-optional-transitive-dependencies/target/BUCK

      The CI builds demonstrating the failure.

      Let me know if I can help you reproduce the problem.

      Attachments

        Issue Links

          Activity

            People

              michael-o Michael Osipov
              arlol Arlo Louis O'Keeffe
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: