'How to configure maven-dependency-plugin to prevent download transitive dependencies with system scope?

I'm using maven-dependency plugin (dependency:copy-dependencies 3.2.0) to copy dependencies from some projects, including the transitive ones. My problem is that it is copying also dependencies with system scope.

I have a dependency (hbase-annotations) in my project that has this system dependency:

    <dependency>
      <groupId>jdk.tools</groupId>
      <artifactId>jdk.tools</artifactId>
      <version>1.7</version>
      <scope>system</scope>
      <systemPath>${java.home}/../lib/tools.jar</systemPath>
    </dependency>

I tried to set the plugin this way:

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>${maven-dependency.version}</version>
          <configuration>
            <excludeClassifiers>sources,javadoc,full,pom
            </excludeClassifiers>
            <excludeScope>system</excludeScope>
            <includeScope>compile</includeScope>
          </configuration>
        </plugin>

But it is not working. it is still downloading transitive dependencies with system scope.

[INFO] Copying tools.jar to /mycloud/jenkins/work/workspace/comp-haddop/target/dependency/jdk.tools-1.7.jar



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source