[
https://issues.apache.org/jira/browse/MNG-5866?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Robert Scholte closed MNG-5866.
-------------------------------
Resolution: Won't Fix
Assignee: Robert Scholte
Ok, so the maven-dependency-plugin only scans if the direct dependencies are
used by the source code. There are two important things to know: pom model
4.0.0 won't change. It is used by a lot of tools. Especially changing
dependency related markup intends different behavior and if tools validate the
pom.xml.
The next thing is that the pom.xml is not interested in the content of the
artifact, hence it is not Maven (core) who can detect if a dependency is really
used or not. In the end it is all about *resolving* the required dependencies.
It is your choice to change the dependency, hence it is also your
responsibility to inform the maven-dependency-plugin to handle this dependency
as such. (you could also blame freemarker for changing their groupId or
hibernate for not updating that dependency ;) )
I'd suggest to add
{code:xml}
<configuration>
<usedDependencies>
<usedDependency>org.freemarker:freemarker</usedDependency>
</usedDependencies>
</configuration>
{code}
> 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
> Assignee: Robert Scholte
> 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)