Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Synchronize Gradle projects with workspace failed

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

like image 686
Andrea Bevilacqua Avatar asked Feb 20 '17 21:02

Andrea Bevilacqua


Video Answer


3 Answers

  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.

like image 200
Arun Mohan Avatar answered Oct 19 '22 16:10

Arun Mohan


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.

like image 39
Darlesh Avatar answered Oct 19 '22 16:10

Darlesh


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>
like image 5
Atul Kumar Sharma Avatar answered Oct 19 '22 15:10

Atul Kumar Sharma