diff options
author | Fred Bricon | 2018-08-21 20:13:58 +0000 |
---|---|---|
committer | Fred Bricon | 2018-08-21 20:13:58 +0000 |
commit | a7c65e3f08584932ba5ef2c8428239e7d0570dc9 (patch) | |
tree | 4a583d427195c9823d8c2acfe25ee54beccd59c1 /org.eclipse.m2e.jdt/src | |
parent | ae8412fb3194b747f995c897454da535c66f9fe9 (diff) | |
download | m2e-core-a7c65e3f08584932ba5ef2c8428239e7d0570dc9.tar.gz m2e-core-a7c65e3f08584932ba5ef2c8428239e7d0570dc9.tar.xz m2e-core-a7c65e3f08584932ba5ef2c8428239e7d0570dc9.zip |
Bug 414645 : limit runtime-scoped dependencies visibility to test classpath
Change-Id: Id128d2a867968463d4a6bc8a35f93a6bdfc8ead8
Signed-off-by: Fred Bricon <fbricon@gmail.com>
Diffstat (limited to 'org.eclipse.m2e.jdt/src')
-rw-r--r-- | org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/DefaultClasspathManagerDelegate.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/DefaultClasspathManagerDelegate.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/DefaultClasspathManagerDelegate.java index 65f492fd..45d360eb 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/DefaultClasspathManagerDelegate.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/DefaultClasspathManagerDelegate.java @@ -126,10 +126,10 @@ public class DefaultClasspathManagerDelegate implements IClasspathManagerDelegat entry = classpath.addProjectEntry(projectPath); ProjectTestAttributes testAttributes = projectTestAttributes.get(projectPath); if(testAttributes == null) { - testAttributes = new ProjectTestAttributes(isTestScope(a), !isTestArtifact(a)); + testAttributes = new ProjectTestAttributes(isOnlyVisibleByTests(a), !isTestArtifact(a)); projectTestAttributes.put(projectPath, testAttributes); } else { - testAttributes.isTest &= isTestScope(a); + testAttributes.isTest &= isOnlyVisibleByTests(a); testAttributes.excludeTestSources &= !isTestArtifact(a); } @@ -137,7 +137,7 @@ public class DefaultClasspathManagerDelegate implements IClasspathManagerDelegat File artifactFile = a.getFile(); if(artifactFile != null /*&& artifactFile.canRead()*/) { entry = classpath.addLibraryEntry(Path.fromOSString(artifactFile.getAbsolutePath())); - entry.setClasspathAttribute(IClasspathManager.TEST_ATTRIBUTE, isTestScope(a) ? "true" : null); + entry.setClasspathAttribute(IClasspathManager.TEST_ATTRIBUTE, isOnlyVisibleByTests(a) ? "true" : null); } } @@ -158,8 +158,8 @@ public class DefaultClasspathManagerDelegate implements IClasspathManagerDelegat }); } - private boolean isTestScope(Artifact a) { - return Artifact.SCOPE_TEST.equals(a.getScope()); + private boolean isOnlyVisibleByTests(Artifact a) { + return Artifact.SCOPE_TEST.equals(a.getScope()) || Artifact.SCOPE_RUNTIME.equals(a.getScope()); } private boolean isTestArtifact(Artifact a) { |