Only add module attribute for non-test entries (#1383)

This commit is contained in:
Sheng Chen 2023-08-18 12:34:50 +08:00
Родитель 0f477a0f73
Коммит 7f7b91eb35
1 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -515,13 +515,16 @@ public class GradleBuildServerBuildSupport implements IBuildSupport {
List<IClasspathAttribute> attributes = new LinkedList<>(); List<IClasspathAttribute> attributes = new LinkedList<>();
if (isTest) { if (isTest) {
attributes.add(testAttribute); attributes.add(testAttribute);
} else if (isModular) {
// Assume that a test-only dependency is not a module, which corresponds
// to how Eclipse does test running for modules:
// It patches the main module with the tests and expects test dependencies
// to be part of the unnamed module (classpath).
attributes.add(modularAttribute);
} }
if (!artifact.exists()) { if (!artifact.exists()) {
attributes.add(optionalAttribute); attributes.add(optionalAttribute);
} }
if (isModular) {
attributes.add(modularAttribute);
}
dependencyEntries.add(JavaCore.newLibraryEntry( dependencyEntries.add(JavaCore.newLibraryEntry(
new Path(artifact.getAbsolutePath()), new Path(artifact.getAbsolutePath()),