buildship
buildship copied to clipboard
Rename project name when conflict
Steps to Reproduce
- Given https://github.com/Tapadoo/Alerter.git
- Import it in VS Code with redhat.java 1.9.0 (which integrates buildship)
- there is an error:
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:
- If we rename the root folder name from
Alerter
toalerter
(in this way, the root folder has the same name with the sub folder), the project will be imported successfully asalerter-alerter
. So I think the conflict avoiding mechanism is existing, but not covering the case (eclipse will check resource name regardless of the case) - 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 alreadyalerter-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.
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