eclipse / buildship

The Eclipse Plug-ins for Gradle project.
530 stars 169 forks source link

Rename project name when conflict #1199

Open CsCherrYY opened 2 years ago

CsCherrYY commented 2 years ago

Steps to Reproduce

  1. Given https://github.com/Tapadoo/Alerter.git
  2. Import it in VS Code with redhat.java 1.9.0 (which integrates buildship)
  3. there is an error:
    image

Expected Behavior

The project has been imported successfully

Context

The project has Alerter the root folder name and alerter the sub project name, is might cause project name conflict. We already have a guide for this: https://github.com/eclipse/buildship/blob/master/docs/user/Faq.md#q-a-project-with-this-name-already-exists-what-can-i-do, adding a snippet to build.gradle file to configure this. But the solution needs manual configuration and it will rename all the project even if their names have no conflict.

Some extra info:

  1. If we rename the root folder name from Alerter to alerter (in this way, the root folder has the same name with the sub folder), the project will be imported successfully as alerter-alerter. So I think the conflict avoiding mechanism is existing, but not covering the case (eclipse will check resource name regardless of the case)
  2. It seems the name converting process is happen in Gradle side, when I try to get org.gradle.plugins.ide.eclipse.model.EclipseProject via TAPI, the project name is already alerter-alerter, so the transform seems to happen in Gradle eclipse modeling part.

I proposed a solution in jdt.ls side: https://github.com/eclipse/eclipse.jdt.ls/pull/2190 to help users import these projects without manual configuration. And it would be great if the changes could happen in Gradle side(IIUC) or buildship side.

CsCherrYY commented 2 years ago

it seems the check happens in Gradle eclipse plugin: https://github.com/gradle/gradle/blob/dd350d3d50f7b7ea43f2a726739acb2c4645f30b/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/internal/SourceFoldersCreator.java#L163-L166