Skip to content

Commit d31ccee

Browse files
committed
Export the entries of transitive dependencies
JDT has a concept of exporting classpath entries that can be used when referencing a project in the remote-debugger, currently no entries are exported. This sets the exported flag for all items that are normally transitive in maven.
1 parent 1b8661c commit d31ccee

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/DefaultClasspathManagerDelegate.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ void addClasspathEntries(IClasspathDescriptor classpath, IMavenProjectFacade fac
148148
entry.setArtifactKey(new ArtifactKey(a.getGroupId(), a.getArtifactId(), a.getBaseVersion(), a.getClassifier()));
149149
entry.setScope(a.getScope());
150150
entry.setOptionalDependency(a.isOptional());
151+
entry.setExported(isExportedArtifact(a));
151152
}
152153
}
153154

@@ -161,6 +162,19 @@ void addClasspathEntries(IClasspathDescriptor classpath, IMavenProjectFacade fac
161162
});
162163
}
163164

165+
private boolean isExportedArtifact(Artifact a) {
166+
if(Artifact.SCOPE_PROVIDED.equals(a.getScope())) {
167+
//provided items are not transitive
168+
return false;
169+
}
170+
if(a.isOptional()) {
171+
//optional artifacts are also not transitive
172+
return false;
173+
}
174+
//everything else is considered transitive
175+
return true;
176+
}
177+
164178
private boolean isOnlyVisibleByTests(Artifact a) {
165179
return Artifact.SCOPE_TEST.equals(a.getScope()) || Artifact.SCOPE_RUNTIME.equals(a.getScope());
166180
}

0 commit comments

Comments
 (0)