You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Robert Scholte (JIRA)" <ji...@apache.org> on 2015/07/30 17:36:05 UTC

[jira] [Commented] (MNG-5866) A way to replace a transitive dependency

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

Robert Scholte commented on MNG-5866:
-------------------------------------

IIUC the real issue is that the analyze goal of the dependency-plugin gives a warning. I hope you know that this plugin also has some options to fine tune the output, see http://maven.apache.org/plugins/maven-dependency-plugin/analyze-mojo.html
However, I think that the real cause is scope related: hibernate-tools has the {{test}}-scope, so all it's dependencies will have the same scope. You haven't specified the scope for {{org.freemarker:freemarker}}, so it gets the {{compile}} scope. The analyze goals seems to detect correctly that this dependency isn't used at compile time, so that's probably the reason for this warning.

> A way to replace a transitive dependency
> ----------------------------------------
>
>                 Key: MNG-5866
>                 URL: https://issues.apache.org/jira/browse/MNG-5866
>             Project: Maven
>          Issue Type: New Feature
>          Components: Dependencies
>    Affects Versions: 3.3.3
>         Environment: all
>            Reporter: Henry Hoendervangers
>            Priority: Minor
>
> we need a way to replace a transitive dependency. It is needed because the dependency:analyze will throw a warning if you exclude the transitive dependency and declare another dependency to replace the transitive dependency. For example: 
> {code}
> <dependency>
>   <groupId>org.hibernate</groupId>
>   <artifactId>hibernate-tools</artifactId>
>   <scope>test</scope>
>   <exclusions>
>     <exclusion>
>       <groupId>freemarker</groupId>
>       <artifactId>freemarker</artifactId>
>     </exclusion>
>   </exclusions>
> </dependency>
> <dependency>
>   <groupId>org.freemarker</groupId>
>   <artifactId>freemarker</artifactId>
> </dependency>
> {code}
> this will cause dependency:analyze to throw a warning on the org.freemarker:freemarker dependency because it's unused.
> possible sollution:
> {code}
> <dependency>
>   <groupId>org.hibernate</groupId>
>   <artifactId>hibernate-tools</artifactId>
>   <scope>test</scope>
>   <exclusions>
>     <exclusion>
>       <groupId>freemarker</groupId>
>       <artifactId>freemarker</artifactId>
>     </exclusion>
>   </exclusions>
>   <inclusions>
>     <inclusion>
>       <groupId>org.freemarker</groupId>
>       <artifactId>freemarker</artifactId>
>     </inclusion>
>   </inclusions>
> </dependency>
> {code}
> org.freemarker:freemarker can now be marked as transitive. It would also be nice to be able to replace a transitive dependency with more than 1 dependency.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)