Actually, I did try that and found it wasnāt sufficient. It did make the earlier-reported error go away, but still left an error:
org.eclipse.buildship.core.GradlePluginsRuntimeException: A project with the name rms64 already exists.
at org.eclipse.buildship.core.workspace.internal.ProjectNameUpdater.ensureProjectNameIsFree(ProjectNameUpdater.java:78)
at org.eclipse.buildship.core.workspace.internal.ProjectNameUpdater.ensureProjectNameIsFree(ProjectNameUpdater.java:67)
at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation.addNewEclipseProjectToWorkspace(SynchronizeGradleBuildOperation.java:271)
at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation.synchronizeNonWorkspaceProject(SynchronizeGradleBuildOperation.java:255)
at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation.synchronizeGradleProjectWithWorkspaceProject(SynchronizeGradleBuildOperation.java:180)
at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation.synchronizeGradleBuildWithWorkspace(SynchronizeGradleBuildOperation.java:143)
at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation.access$000(SynchronizeGradleBuildOperation.java:108)
at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation$1.run(SynchronizeGradleBuildOperation.java:125)
at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:729)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2313)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5358)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5315)
at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation.run(SynchronizeGradleBuildOperation.java:122)
at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildsJob.synchronizeBuild(SynchronizeGradleBuildsJob.java:78)
at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildsJob.runToolingApiJob(SynchronizeGradleBuildsJob.java:69)
at org.eclipse.buildship.core.util.progress.ToolingApiJob$1.run(ToolingApiJob.java:73)
at org.eclipse.buildship.core.util.progress.ToolingApiInvoker.invoke(ToolingApiInvoker.java:63)
at org.eclipse.buildship.core.util.progress.ToolingApiJob.run(ToolingApiJob.java:70)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
This is the build script producing this:
ext.baseName ='transw'
version '12.0.2'
apply plugin: "eclipse"
subprojects { Project proj ->
proj.eclipse.project.name = (this.name + proj.path).replaceAll(':', '-')
}
I was going to leave it there, but then it occurred to me that I hadnāt put the same strategy into effect in the OTHER project, the already-imported project that also had a subproject named rms64.
So I made this same change to the other project, deleted the original project from Eclipse and tried reimporting it. This did not give me the error (as of course it wouldnāt, since there was no duplicate) but I found that it ONLY imported the subporject. It did not create an Eclipse project for the parent.
I tried several; variants of this strategy, none of which behaved as I expected. I finally found this strategy, which works:
In EVERY project, root and subprojects, I have the following code:
apply plugin: 'eclipse'
if (project != rootProject) {
eclipse.project.name = (rootProject.name + project.path).replaceAll(':', '-')
} else {
eclipse.project.name = rootProject.name
}
This does work. And of course, so does this:
In root project:
apply plugin: 'eclipse'
eclipse.project.name = rootProject.name
In subprojects:
apply plugin: 'eclipse'
eclipse.project.name = (rootProject.name + project.path).replaceAll(':', '-')
But I could not find a solution that could be implemented using just a subprojects{}
closure in the parent project. From the results I got I assume this is because trying to do so all in the root project only creates one āeclipseā object. Eclipse must be applied separately in both parents and children to get āeclipseā objects in both.