Synchronize Gradle projects with workspace failed

27,153

Solution 1

So I noticed that the "settings.gradle" file was setting the root project name, and after the project rename, it still had the old name. Once I changed that name to the new name and refreshed the project, that error went away.

Solution 2

Have faced the same issue and sorted by updating 2 files in Project root.

1) settings.gradle file ==>

      rootProject.name='ToMyNewProjectName'

2) .project file ==>

         <ProjectDescription>
           <name> ToMyNewProjectName </name>
          </ProjectDescription>

Solution 3

  1. right click on project -> properties -> click on checkbox "Override workspace settings" under gradle
  2. click radio button "local installation directory" -> browse and choose the gradle installed folder
  3. under "Gradle User Home" -> choose the ".gradle" folder from users

rebuild the project after this.

Share:
27,153
Andrea Bevilacqua
Author by

Andrea Bevilacqua

Updated on July 05, 2022

Comments

  • Andrea Bevilacqua
    Andrea Bevilacqua almost 2 years

    I've the Spring Tool Suite v3.8.3 and its component Spring IDE v3.8.4.201702201939-CI-B1500. I've also the Gradle Buildship v2.0.

    I created a project with JHipster v4.0.5 but is not possible to import it. (there were not errors before the Gradle Buildship 2). Below the error:

    Synchronize Gradle projects with workspace failed due to an unsupported configuration in the referenced Gradle build. Project at 'C:\ws\Testa' can't be named 'testa' because it's located directly under the workspace root. If such a project is renamed, Eclipse would move the container directory. To resolve this problem, move the project out of the workspace root or configure it to have the name 'Testa'.

    org.eclipse.buildship.core.UnsupportedConfigurationException: Project at 'C:\ws\Testa' can't be named 'testa' because it's located directly under the workspace root. If such a project is renamed, Eclipse would move the container directory. To resolve this problem, move the project out of the workspace root or configure it to have the name 'Testa'.
        at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceOperations.validateProjectName(DefaultWorkspaceOperations.java:190)
        at org.eclipse.buildship.core.workspace.internal.ProjectNameUpdater.checkProjectName(ProjectNameUpdater.java:107)
        at org.eclipse.buildship.core.workspace.internal.ProjectNameUpdater.ensureProjectNameIsFree(ProjectNameUpdater.java:71)
        at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation.addNewEclipseProjectToWorkspace(SynchronizeGradleBuildOperation.java:274)
        at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation.synchronizeNonWorkspaceProject(SynchronizeGradleBuildOperation.java:258)
        at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation.synchronizeGradleProjectWithWorkspaceProject(SynchronizeGradleBuildOperation.java:182)
        at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation.access$000(SynchronizeGradleBuildOperation.java:106)
        at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation$1.run(SynchronizeGradleBuildOperation.java:141)
        at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2240)
        at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2262)
        at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation.synchronizeProjectsWithWorkspace(SynchronizeGradleBuildOperation.java:138)
        at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation.run(SynchronizeGradleBuildOperation.java:122)
        at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildsJob.synchronizeBuild(SynchronizeGradleBuildsJob.java:77)
        at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildsJob.runToolingApiJob(SynchronizeGradleBuildsJob.java:68)
        at org.eclipse.buildship.core.util.progress.ToolingApiJob$1.run(ToolingApiJob.java:73)
        at org.eclipse.buildship.core.util.progress.ToolingApiInvoker.invoke(ToolingApiInvoker.java:62)
        at org.eclipse.buildship.core.util.progress.ToolingApiJob.run(ToolingApiJob.java:70)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
    

    Any help?

    Thanks Regards, Andrea