mavenantmaven-ant-tasks

How to exclude transitive dependency in ant build using maven task for ant?


How to exclude transitive dependency in maven task for ant. Scope: runtime and provided doesn't seem to be of any help in this case. This is my build.xml

<artifact:remoteRepository url="https://mynexus/" id="remote.repository"/>

<artifact:dependencies filesetId="dependency.fileset" useScope="runtime">
     <dependency version="1.7.0" artifactId="commons-beanutils" groupId="commons-beanutils"/>
</artifact:dependencies>

commons-beanutils has dependency commons-logging that I need to exclude.


Solution

  • maven-ant supports this exclusion, please RTFM https://maven.apache.org/ant-tasks/reference.html#exclusion

    just as

    <artifact:dependencies filesetId="dependency.fileset" useScope="runtime">
      <artifact:dependency version="1.7.0" artifactId="commons-beanutils" groupId="commons-beanutils">
        <exclusion groupId="commons-logging" artifactId="commons-logging">
      </<artifact:dependency>
    </artifact:dependencies>
    

    But I didn't find any supports for exclude some dependencies defined by a pom file