eclipse / buildship

The Eclipse Plug-ins for Gradle project.
533 stars 170 forks source link

connection.project.dir setting with path separator in org.eclipse.buildship.core.prefs not cross-OS compatible #515

Closed typekpb closed 7 years ago

typekpb commented 7 years ago

I'm living in a world, where file: .settings/org.eclipse.buildship.core.prefs is delivered in source controll The problem comes as property: connection.project.dir is not compatible across OSes (understand Windows vs Linux).

Those having Windows expect:

connection.project.dir=..\\rootproject

whareas Linux users need to have there:

connection.project.dir=../rootproject

Otherwise one or another side sees error. For the case of windows-compatible one, I see on Linux:

Project directory 'xxx/eclipse_workspace/childproject/..\rootproject' does not exist.

My expectation would be, that connection.project.dir=../rootproject should be accepted without problems on any OS (as backslash is really Windows specific only).

Having hundreds gradle/eclipse subprojects, as we do, makes things painful. Please fix.

donat commented 7 years ago

Hi! This issue was addressed in the 2.0.1 release. In case you use an older version then just do an update. Also, - IIRC - the \\ separators are still accepted for compatibility reasons.

typekpb commented 7 years ago

@donat well, I don't know where the problem is, but I use:

 Buildship: Eclipse Plug-ins for Gradle 2.0.2.v20170420-0909

however for:

connection.project.dir=..\\rootproject

I still get (on Linux):

Synchronize Gradle projects with workspace failed due to an error in the referenced Gradle build.
Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-3.5-bin.zip'.

Project directory '/home/foo/bar/..\rootproject' does not exist.
org.gradle.tooling.BuildException: Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-3.5-bin.zip'.
    at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(ExceptionTransformer.java:51)
    at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(ExceptionTransformer.java:29)
    at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:41)
    at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:57)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:46)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
    at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46)
    at org.gradle.tooling.internal.consumer.DefaultBuildActionExecuter.run(DefaultBuildActionExecuter.java:60)
    at com.gradleware.tooling.toolingclient.internal.DefaultToolingClient.executeAndWait(DefaultToolingClient.java:106)
    at com.gradleware.tooling.toolingclient.internal.DefaultBuildActionRequest.executeAndWait(DefaultBuildActionRequest.java:51)
    at com.gradleware.tooling.toolingmodel.repository.internal.DefaultModelRepository$13.get(DefaultModelRepository.java:287)
    at com.gradleware.tooling.toolingmodel.repository.internal.DefaultModelRepository.executeAndWait(DefaultModelRepository.java:355)
    at com.gradleware.tooling.toolingmodel.repository.internal.DefaultModelRepository.access$100(DefaultModelRepository.java:49)
    at com.gradleware.tooling.toolingmodel.repository.internal.DefaultModelRepository$14.call(DefaultModelRepository.java:313)
    at com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4724)
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3522)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2315)
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2278)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2193)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3932)
    at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4721)
    at com.gradleware.tooling.toolingmodel.repository.internal.DefaultModelRepository.getFromCache(DefaultModelRepository.java:330)
    at com.gradleware.tooling.toolingmodel.repository.internal.DefaultModelRepository.executeRequest(DefaultModelRepository.java:309)
    at com.gradleware.tooling.toolingmodel.repository.internal.DefaultModelRepository.executeRequest(DefaultModelRepository.java:280)
    at com.gradleware.tooling.toolingmodel.repository.internal.DefaultModelRepository.fetchEclipseGradleProjects(DefaultModelRepository.java:238)
    at org.eclipse.buildship.core.workspace.internal.DefaultModelProvider.fetchEclipseGradleProjects(DefaultModelProvider.java:66)
    at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildsJob.fetchEclipseProjects(SynchronizeGradleBuildsJob.java:87)
    at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildsJob.synchronizeBuild(SynchronizeGradleBuildsJob.java:79)
    at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildsJob.runToolingApiJob(SynchronizeGradleBuildsJob.java:72)
    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)
Caused by: org.gradle.internal.exceptions.LocationAwareException: Project directory '/home/foo/bar/..\rootproject' does not exist.
    at org.gradle.initialization.DefaultExceptionAnalyser.transform(DefaultExceptionAnalyser.java:74)
    at org.gradle.initialization.MultipleBuildFailuresExceptionAnalyser.transform(MultipleBuildFailuresExceptionAnalyser.java:47)
    at org.gradle.initialization.StackTraceSanitizingExceptionAnalyser.transform(StackTraceSanitizingExceptionAnalyser.java:30)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:114)
    at org.gradle.initialization.DefaultGradleLauncher.getBuildAnalysis(DefaultGradleLauncher.java:100)
    at org.gradle.launcher.exec.GradleBuildController.configure(GradleBuildController.java:74)
    at org.gradle.tooling.internal.provider.runner.ClientProvidedBuildActionRunner.run(ClientProvidedBuildActionRunner.java:65)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner$1.execute(RunAsBuildOperationBuildActionRunner.java:43)
    at org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner$1.execute(RunAsBuildOperationBuildActionRunner.java:40)
    at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56)
    at org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:40)
    at org.gradle.tooling.internal.provider.runner.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:88)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
    at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75)
    at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:49)
    at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:49)
    at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:31)
    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
    at org.gradle.util.Swapper.swap(Swapper.java:38)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:46)
Caused by: org.gradle.api.InvalidUserDataException: Project directory '/home/foo/bar/..\rootproject' does not exist.
    at org.gradle.initialization.ProjectDirectoryProjectSpec.checkPreconditions(ProjectDirectoryProjectSpec.java:52)
    at org.gradle.initialization.AbstractProjectSpec.containsProject(AbstractProjectSpec.java:27)
    at org.gradle.initialization.DefaultSettingsLoader.findAndLoadSettings(DefaultSettingsLoader.java:51)
    at org.gradle.internal.composite.CompositeBuildSettingsLoader.findAndLoadSettings(CompositeBuildSettingsLoader.java:48)
    at org.gradle.initialization.NotifyingSettingsLoader.findAndLoadSettings(NotifyingSettingsLoader.java:33)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:135)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)
    ... 44 more

In the test provided with fix (https://github.com/eclipse/buildship/pull/203/commits/cc62242c2be126752658f4291afe7cc280e70be3) you guys use: connection.project.dir=..\\\\.. so should I use 4 instead of 2 backslashes to let things work on both systems properly? I don't see any other difference, to be honest.

typekpb commented 7 years ago

@donat just gave it a try with 4 backslashes and problem is the same (just invalid reported path is: '/home/foo/bar/..\\rootproject')

donat commented 7 years ago

Sorry for my vague phrasing, I meant \\ should be still accepted on Windows. That's exactly what the test you've found verifies. The 4 backslashes are only specific to Groovy, the created configuration file contains connection.project.dir=..\\...

You should always use the / on all platforms as a path separator and every instance \\ should be replaced.

oehme commented 7 years ago

Buildship will always generate / now, so just refreshing the project and checking it in should help. / will also work on Windows.

typekpb commented 7 years ago

excellent, will give it a try!

donat commented 7 years ago

Due to inactivity, I'm closing this issue. Feel free to reopen it if there's an update.