[ 
https://issues.apache.org/jira/browse/MSHARED-437?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15995141#comment-15995141
 ] 

Michael Osipov commented on MSHARED-437:
----------------------------------------

[~arlol], [~rfscholte], so I applied the patch from Christian:

{noformat}
[INFO]
[INFO] --- maven-invoker-plugin:2.0.0:run (integration-test) @ 
export-dependencies-maven-plugin ---
[INFO] Building: buck-bom-managed-optional-transitive-dependencies\pom.xml
[INFO] run script postbuild.bsh
[INFO] ..SUCCESS (1.7 s)
[INFO] Building: buck-bom-managed-single-dependency\pom.xml
[INFO] run script postbuild.bsh
[INFO] ..SUCCESS (1.5 s)
[INFO] Building: buck-bom-managed-transitive-dependencies\pom.xml
[INFO] run script postbuild.bsh
[INFO] ..SUCCESS (1.5 s)
[INFO] Building: buck-managed-optional-transitive-dependencies\pom.xml
[INFO] run script postbuild.bsh
[INFO] ..SUCCESS (1.4 s)
[INFO] Building: buck-managed-single-dependency\pom.xml
[INFO] run script postbuild.bsh
[INFO] ..SUCCESS (1.4 s)
[INFO] Building: buck-managed-transitive-dependencies\pom.xml
[INFO] run script postbuild.bsh
[INFO] ..SUCCESS (1.5 s)
[INFO] Building: buck-optional-single-dependency\pom.xml
[INFO] run script postbuild.bsh
[INFO] ..SUCCESS (1.4 s)
[INFO] Building: buck-optional-transitive-dependencies\pom.xml
[INFO] run script postbuild.bsh
[INFO] ..SUCCESS (1.6 s)
[INFO] Building: buck-reactor\pom.xml
[INFO] run script postbuild.bsh
[INFO] ..SUCCESS (1.4 s)
[INFO] Building: buck-single-dependency\pom.xml
[INFO] run script postbuild.bsh
[INFO] ..SUCCESS (1.4 s)
[INFO] Building: buck-transitive-dependencies\pom.xml
[INFO] run script postbuild.bsh
[INFO] ..SUCCESS (1.4 s)
[INFO] -------------------------------------------------
[INFO] Build Summary:
[INFO]   Passed: 11, Failed: 0, Errors: 0, Skipped: 0
[INFO] -------------------------------------------------
[INFO]
[INFO] --- maven-gpg-plugin:1.6:sign (sign-artifacts) @ 
export-dependencies-maven-plugin ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 28.708 s
[INFO] Finished at: 2017-05-03T18:02:57+02:00
[INFO] Final Memory: 32M/319M
[INFO] ------------------------------------------------------------------------
{noformat}

It does indeed solve the issue.

[~arlol], can you strip down your sample project for us? I'd like fix MNG-5935 
with Christian's commit and add your minimal sample project as an IT for that. 
IT perfectly depicts the issue. I'd appreciate if you could create a PR for the 
IT. If you need guidance, please ask.

> maven-dependency-tree removes optional flag from managed dependencies
> ---------------------------------------------------------------------
>
>                 Key: MSHARED-437
>                 URL: https://issues.apache.org/jira/browse/MSHARED-437
>             Project: Maven Shared Components
>          Issue Type: Bug
>          Components: maven-dependency-tree
>    Affects Versions: maven-dependency-tree-2.2
>            Reporter: Arlo Louis O'Keeffe
>            Assignee: Michael Osipov
>            Priority: Minor
>             Fix For: maven-dependency-tree-3.0.1
>
>
> Given the following 
> [pom|https://github.com/evosec/export-dependencies-maven-plugin/blob/21d80e29bd2e3507e97556e6eeee5f2f962fb7b0/src/it/buck-bom-managed-optional-transitive-dependencies/pom.xml]
>  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|https://github.com/evosec/export-dependencies-maven-plugin/blob/a931ee09c0880097b73e2010d71b000ede3acbfe/src/it/buck-optional-transitive-dependencies/pom.xml]
>  it works.
> There are some integration tests in this 
> [repository|https://github.com/evosec/export-dependencies-maven-plugin] 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|https://travis-ci.org/evosec/export-dependencies-maven-plugin/builds/81137480].
> Let me know if I can help you reproduce the problem.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to