JavaSheriff
JavaSheriff

Reputation: 7665

maven assembly- to ignore dependency of zip dependancy

When specifying dependency of type ZIP,
Is it possible to ignore its dependencies once packaging/assembling the artifact?

<dependency> 
  <groupId>com.groupId.</groupId> 
  <artifactId>testProject</artifactId> 
  <version>1.0-SNAPSHOT</version> 
  <type>zip</type> 
</dependency> 

I tried * as exclude in the assembly file, but it doesn't seems like it have any effect

<assembly>
  <id>release</id>
  <formats>
    <format>dir</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <moduleSets>
    <moduleSet>
      <excludes>
        <exclude>*</exclude>
      </excludes>
    </moduleSet>
  </moduleSets>
</assembly>

Thank you!

Upvotes: 0

Views: 461

Answers (1)

Raghuram
Raghuram

Reputation: 52635

If I understand your question correctly, you want to exclude transitive dependencies of one specific dependency, which is of type zip.

  <dependencySets>
    <dependencySet>
      <includes>
        <include>com.groupId:testProject:zip</exclude>
        <useTransitiveDependencies>false</useTransitiveDependencies>
      </includes>
    </dependencySet>
    ....
  </dependencySets>

You would use moduleSet in a multi-module project.

Upvotes: 1

Related Questions