Skip to content

Commit

Permalink
Failed to import a folder with multi gradle projects
Browse files Browse the repository at this point in the history
Signed-off-by: Snjezana Peco <[email protected]>
  • Loading branch information
snjeza committed Jun 6, 2024
1 parent 3a8937a commit b6170d9
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 0 deletions.
2 changes: 2 additions & 0 deletions org.eclipse.jdt.ls.core/gradle/init/init.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ allprojects {
// Add prefix when project name has conflicts with root project name
if (project != rootProject && rootProject.name.toLowerCase() == project.name.toLowerCase()) {
eclipse.project.name = (rootProject.name + project.path).replaceAll(':', '-')
} else if (project == rootProject && rootProject.name.toLowerCase() != project.projectDir.name.toLowerCase()) {
eclipse.project.name = (rootProject.name + '-' + project.projectDir.name).replaceAll(':', '-')
}
})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
plugins {
id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

repositories {
mavenCentral()
}

dependencies {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'rest-service'
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
plugins {
id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

repositories {
mavenCentral()
}

dependencies {

}

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'rest-service'
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,17 @@ public void testNameConflictProject() throws Exception {
assertIsGradleProject(subProject);
}

// https://github.com/eclipse-jdtls/eclipse.jdt.ls/issues/1743
@Test
public void testNameConflictProject2() throws Exception {
List<IProject> projects = importProjects("gradle/nameconflict2");
assertEquals(2, projects.size());
IProject project1 = WorkspaceHelper.getProject("rest-service-initial");
assertIsGradleProject(project1);
IProject project2 = WorkspaceHelper.getProject("rest-service-complete");
assertIsGradleProject(project2);
}

@Test
public void testAndroidProjectSupport() throws Exception {
try {
Expand Down

0 comments on commit b6170d9

Please sign in to comment.