Hi,
Posting here cause I’d like to discuss before filing either a bug report or a feature request.
Am working on Egit to support switching between worktrees and am running into a challenge with buildship on projects that have the Gradle nature
Consider the following scenario:
- got a multi-module project git repo checked out, imported the projects and ran Gradble Refresh project, which created x projects in Eclipse, based on the gradle config of the checked out repo. So far all is fine!
- Now I create a new worktree (directly through git on the commandline, as jgit/egit doesn’t support that yet)
- Through my (experimental) ‘Switch Worktree’ command I’ve implemented in EGit, I now switch the existing projects to the new worktree, using the following code (basically): project.move(description, IResource.REPLACE | IResource.FORCE, null);
What now happens is that, on the Eclipse level, the existing project retains its Gradle project nature, but because the entire worktree is switched out, the entire .settings folder, including the org.eclipse.buildship.core.prefs
file is gone.
Due to that, I’m already getting this error straight away:
> org.eclipse.buildship.core.internal.GradlePluginsRuntimeException: Can't read root project location for project located at C:\Users\xxx\git\xxx\testing123\tests
> at org.eclipse.buildship.core.internal.configuration.BuildConfigurationPersistence.readPathToRoot(BuildConfigurationPersistence.java:90)
> at org.eclipse.buildship.core.internal.configuration.DefaultConfigurationManager.loadProjectConfiguration(DefaultConfigurationManager.java:123)
> at org.eclipse.buildship.core.internal.workspace.SynchronizingBuildScriptUpdateListener.isEnabledInPreferences(SynchronizingBuildScriptUpdateListener.java:63)
> at org.eclipse.buildship.core.internal.workspace.SynchronizingBuildScriptUpdateListener.doVisitDelta(SynchronizingBuildScriptUpdateListener.java:85)
> at org.eclipse.buildship.core.internal.workspace.SynchronizingBuildScriptUpdateListener$1.visit(SynchronizingBuildScriptUpdateListener.java:73)
> at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:77)
> at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:87)
> at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:61)
> at org.eclipse.buildship.core.internal.workspace.SynchronizingBuildScriptUpdateListener.visitDelta(SynchronizingBuildScriptUpdateListener.java:68)
> at org.eclipse.buildship.core.internal.workspace.SynchronizingBuildScriptUpdateListener.resourceChanged(SynchronizingBuildScriptUpdateListener.java:55)
> at org.eclipse.core.internal.events.NotificationManager$1.run(NotificationManager.java:321)
> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
> at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:311)
> at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:174)
> at org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:458)
> at org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:1586)
> at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:221)
> at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:300)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
And later on when I call Gradle > Refresh Gradle project
directly on the project in the Package Explorer, nothing happens (besides a quick blip of some test in the status bar, but the project isn’t refreshed and no errors show up anywhere
So, having said all that:
- what is going on and what must happen to make this work properly?
- Is there something I might be doing wrong or not doing at all?
- Might buildship just not anticipated this ‘Project Move’ scenario and can something be done in Buildship to better support it?
- Might this not be an issue in BuildShip but somewhere else in Eclipse, thus I should address it elsewhere?
Any thoughts appreciated!