apache / apache/maven-dependency-plugin

[MDEP-794] It is not respecting the includeScope and excludeScope

Open
#1,300 10 comments 0 reactions 0 assignees View on GitHub
bug priority:critical
Dominant language
Java
Stars
175
Forks
196
Avg merge
19h 30m
Merged PRs (30d)
5

Description

**[Cristiano Gavião](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=cvgaviao)** opened **[MDEP-794](https://issues.apache.org/jira/browse/MDEP-794?redirect=false)** and commented

I'm using the copyDependencies to build a distribution package and I'm getting junit.jar and others on it.

```java

       
          maven-dependency-plugin
          3.2.0
         
            sources,javadoc,full,pom
            system
            compile
         
       
```

 

```java
[DEBUG] Configuring mojo org.apache.maven.plugins:maven-dependency-plugin:3.2.0:copy-dependencies from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-dependency-plugin:3.2.0, parent: sun.misc.Launcher$AppClassLoader@18b4aac2]
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-dependency-plugin:3.2.0:copy-dependencies' with basic configurator -->
[DEBUG]   (f) addParentPoms = false
[DEBUG]   (s) copyPom = false
[DEBUG]   (f) excludeArtifactIds = jdk.tools
[DEBUG]   (f) excludeClassifiers = sources,javadoc,full,pom
[DEBUG]   (f) excludeScope = system
[DEBUG]   (f) excludeTransitive = false
[DEBUG]   (s) failOnMissingClassifierArtifact = false
[DEBUG]   (f) includeScope = compile
[DEBUG]   (s) markersDirectory = C:\Users\cristianoga\git-code\p-stripping\target\dependency-maven-plugin-markers
[DEBUG]   (f) outputAbsoluteArtifactFilename = false
[DEBUG]   (s) outputDirectory = C:\Users\cristianoga\git-code\p-stripping\target\dependency
[DEBUG]   (f) overWriteIfNewer = true
[DEBUG]   (f) overWriteReleases = false
[DEBUG]   (f) overWriteSnapshots = false
[DEBUG]   (s) prependGroupId = false
```

```java
[INFO] Copying junit-4.13.2.jar to C:\Users\cristianoga\git-code\p-stripping\target\dependency\junit-4.13.2.jar
[INFO] Copying hamcrest-core-1.3.jar to C:\Users\cristianoga\git-code\p-stripping\target\dependency\hamcrest-core-1.3.jar
[INFO] Copying mockito-core-3.12.4.jar to C:\Users\cristianoga\git-code\p-stripping\target\dependency\mockito-core-3.12.4.jar
[INFO] Copying byte-buddy-1.11.13.jar to C:\Users\cristianoga\git-code\p-stripping\target\dependency\byte-buddy-1.11.13.jar
[INFO] Copying byte-buddy-agent-1.11.13.jar to C:\Users\cristianoga\git-code\p-stripping\target\dependency\byte-buddy-agent-1.11.13.jar
[INFO] Copying objenesis-3.2.jar to C:\Users\cristianoga\git-code\p-stripping\target\dependency\objenesis-3.2.jar
[INFO] Copying dbunit-2.7.2.jar to C:\Users\cristianoga\git-code\p-stripping\target\dependency\dbunit-2.7.2.jar
[INFO] Copying h2-1.4.200.jar to C:\Users\cristianoga\git-code\p-stripping\target\dependency\h2-1.4.200.jar
[INFO] Copying assertj-core-3.21.0.jar to C:\Users\cristianoga\git-code\p-stripping\target\dependency\assertj-core-3.21.0.jar

```

---

**Affects:** 3.2.0

**Attachments:**
- [Deps.7z](https://issues.apache.org/jira/secure/attachment/13040543/Deps.7z) (_4.64 kB_)
- [Deps2.7z](https://issues.apache.org/jira/secure/attachment/13042351/Deps2.7z) (_6.97 kB_)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the maven-dependency-plugin copy-dependencies goal and reproduce the 3.2.0 configuration using the logged dependencies or attached Deps archives. Trace how includeScope=compile and excludeScope=system are applied, then add a regression test for the reported dependency set and verify that the expected artifacts are copied.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.