Thorsten Glaser created MNG-6724:
------------------------------------

             Summary: Ability to exchange dependencies
                 Key: MNG-6724
                 URL: https://issues.apache.org/jira/browse/MNG-6724
             Project: Maven
          Issue Type: New Feature
            Reporter: Thorsten Glaser


Feature Request: I would like to have the explicit ability to exchange 
dependencies globally, such as from dependencyManagement.

Currently, I can do <excludes> on a dependency’’s transitive dependency, then 
add an explicit <dependency> to the POM of my final WAR (and possibly a 
test-scoped one on the JAR it’s in), but that makes the 
maven-dependency-plugin:3.1.1:analyze-only goal complain about a declared but 
unused dependency.

With the javax.* → jakarta moves (and some others, e.g. I need the 
com.sun.activation version of jakarta.activation instead of the Jakarta one) 
and multiple JAXB implementations around, this is becoming troublesome.

Therefore, I would like for Maven to allow something like this:
{code:java}
<dependencyManagement>
 <substitutions>
  <substitution>
   <exclusion>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
   </exclusion>
   <dependency>
    <groupId>jakarta.xml.bind</groupId>
    <artifactId>jakarta.xml.bind-api</artifactId>
   </dependency>
  </substitution>
  <!-- … -->
 </substitutions>
 <dependencies>
  <dependency>
   <groupId>jakarta.xml.bind</groupId>
   <artifactId>jakarta.xml.bind-api</artifactId>
   <version>${jaxb-api.version}</version>
  </dependency>
  <!-- … -->
 </dependencies>
</dependencyManagement>
{code}
This would recursively replace the old JAXB-API with the new one but not add 
them where unnecessary, and make the maven-dependency-plugin’s checks do the 
right thing.

Thanks in advance for consideration!



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to