I have a Gradle project in my workspace, so in order it to build in Eclipse I have installed latest version of the plugin. After restart I see following error message in my Eclipse: “Initializing Java Tooling” has encountered a problem. An internal error occured during: “Initializing Java Tooling”. With following details:
An internal error occurred during: “Initializing Java Tooling”.
Optional.get() cannot be called on an absent value
When I uninstall this plugin that message is not longer shown.
!ENTRY org.eclipse.ui 4 4 2016-08-22 12:15:59.864
!MESSAGE Exception in Decorator. The ‘Java Build Path Indicator’ decorator will be disabled.
!SUBENTRY 1 org.eclipse.ui 4 4 2016-08-22 12:15:59.864
!MESSAGE Optional.get() cannot be called on an absent value
!STACK 0
java.lang.IllegalStateException: Optional.get() cannot be called on an absent value
at com.google.common.base.Absent.get(Absent.java:42)
at org.eclipse.buildship.core.workspace.internal.GradleClasspathContainerInitializer.updateFromGradleProject(GradleClasspathContainerInitializer.java:66)
at org.eclipse.buildship.core.workspace.internal.GradleClasspathContainerInitializer.loadClasspath(GradleClasspathContainerInitializer.java:61)
at org.eclipse.buildship.core.workspace.internal.GradleClasspathContainerInitializer.initialize(GradleClasspathContainerInitializer.java:39)
at org.eclipse.jdt.internal.core.JavaModelManager.initializeContainer(JavaModelManager.java:2868)
at org.eclipse.jdt.internal.core.JavaModelManager.getClasspathContainer(JavaModelManager.java:1900)
at org.eclipse.jdt.core.JavaCore.getClasspathContainer(JavaCore.java:3298)
at org.eclipse.jdt.internal.core.JavaProject.resolveClasspath(JavaProject.java:2693)
at org.eclipse.jdt.internal.core.JavaProject.resolveClasspath(JavaProject.java:2857)
at org.eclipse.jdt.internal.core.JavaProject.getResolvedClasspath(JavaProject.java:1962)
at org.eclipse.jdt.internal.core.JavaProject.isOnClasspath(JavaProject.java:2240)
at org.eclipse.jdt.internal.ui.BuildpathIndicatorLabelDecorator.getOverlay(BuildpathIndicatorLabelDecorator.java:48)
at org.eclipse.jdt.internal.ui.BuildpathIndicatorLabelDecorator.decorate(BuildpathIndicatorLabelDecorator.java:35)
at org.eclipse.ui.internal.decorators.LightweightDecoratorDefinition.decorate(LightweightDecoratorDefinition.java:273)
at org.eclipse.ui.internal.decorators.LightweightDecoratorManager$LightweightRunnable.run(LightweightDecoratorManager.java:83)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.decorate(LightweightDecoratorManager.java:367)
at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.getDecorations(LightweightDecoratorManager.java:349)
at org.eclipse.ui.internal.decorators.DecorationScheduler$1.ensureResultCached(DecorationScheduler.java:372)
at org.eclipse.ui.internal.decorators.DecorationScheduler$1.run(DecorationScheduler.java:332)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
!ENTRY org.eclipse.core.jobs 4 2 2016-08-22 12:16:00.327
!MESSAGE An internal error occurred during: “Initializing Java Tooling”.
!STACK 0
java.lang.IllegalStateException: Optional.get() cannot be called on an absent value
at com.google.common.base.Absent.get(Absent.java:42)
at org.eclipse.buildship.core.workspace.internal.GradleClasspathContainerInitializer.updateFromGradleProject(GradleClasspathContainerInitializer.java:66)
at org.eclipse.buildship.core.workspace.internal.GradleClasspathContainerInitializer.loadClasspath(GradleClasspathContainerInitializer.java:61)
at org.eclipse.buildship.core.workspace.internal.GradleClasspathContainerInitializer.initialize(GradleClasspathContainerInitializer.java:39)
at org.eclipse.jdt.internal.core.JavaModelManager.initializeContainer(JavaModelManager.java:2868)
at org.eclipse.jdt.internal.core.JavaModelManager$10.run(JavaModelManager.java:2774)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2241)
at org.eclipse.jdt.internal.core.JavaModelManager.initializeAllContainers(JavaModelManager.java:2814)
at org.eclipse.jdt.internal.core.JavaModelManager.getClasspathContainer(JavaModelManager.java:1895)
at org.eclipse.jdt.core.JavaCore.initializeAfterLoad(JavaCore.java:4067)
at org.eclipse.jdt.internal.ui.InitializeAfterLoadJob$RealJob.run(InitializeAfterLoadJob.java:36)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
!ENTRY org.eclipse.core.resources 4 2 2016-08-22 12:16:02.487
!MESSAGE Problems occurred when invoking code from plug-in: “org.eclipse.core.resources”.
!STACK 0
java.lang.IllegalStateException: Optional.get() cannot be called on an absent value
at com.google.common.base.Absent.get(Absent.java:42)
at org.eclipse.buildship.core.workspace.internal.GradleClasspathContainerInitializer.updateFromGradleProject(GradleClasspathContainerInitializer.java:66)
at org.eclipse.buildship.core.workspace.internal.GradleClasspathContainerInitializer.loadClasspath(GradleClasspathContainerInitializer.java:61)
at org.eclipse.buildship.core.workspace.internal.GradleClasspathContainerInitializer.initialize(GradleClasspathContainerInitializer.java:39)
at org.eclipse.jdt.internal.core.JavaModelManager.initializeContainer(JavaModelManager.java:2868)
at org.eclipse.jdt.internal.core.JavaModelManager.getClasspathContainer(JavaModelManager.java:1900)
at org.eclipse.jdt.core.JavaCore.getClasspathContainer(JavaCore.java:3298)
at org.eclipse.jdt.internal.core.JavaProject.resolveClasspath(JavaProject.java:2693)
at org.eclipse.jdt.internal.core.JavaProject.resolveClasspath(JavaProject.java:2857)
at org.eclipse.jdt.internal.core.JavaProject.getResolvedClasspath(JavaProject.java:1962)
at org.eclipse.jdt.internal.core.DeltaProcessor.createExternalArchiveDelta(DeltaProcessor.java:933)
at org.eclipse.jdt.internal.core.DeltaProcessor.checkExternalArchiveChanges(DeltaProcessor.java:804)
at org.eclipse.jdt.internal.core.DeltaProcessor.resourceChanged(DeltaProcessor.java:2003)
at org.eclipse.jdt.internal.core.DeltaProcessingState.resourceChanged(DeltaProcessingState.java:477)
at org.eclipse.core.internal.events.NotificationManager$1.run(NotificationManager.java:299)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:289)
at org.eclipse.core.internal.events.NotificationManager.handleEvent(NotificationManager.java:271)
at org.eclipse.core.internal.resources.Workspace.broadcastEvent(Workspace.java:368)
at org.eclipse.core.internal.resources.Resource.refreshLocal(Resource.java:1592)
at org.eclipse.rse.internal.files.ui.resources.SystemRemoteEditManager.refreshRemoteEditProject(SystemRemoteEditManager.java:794)
at org.eclipse.rse.internal.files.ui.Activator$InitRemoteEditJob.run(Activator.java:77)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Looking at the stacktrace, this can only happen if a project has the Buildship nature, but the .settings/org.eclipse.buildship.core.prefs file has been deleted. Did you delete it manually? Reimporting the project should fix that.
No, I didn’t delete it manually. I have imported a project cloned from git. Maybe the project was never created in Eclipse initially, that’s why those files are missing. How do I fix it?
You were right, I have reviewed the .project file and there was a Gradle nature added. So I have removed it. Re-imported it again and via Configure added the nature back to the project, it started to download dependencies.
So, to summarize: someone has added the gradle nature to the project, but didn’t check in all the files in order for Eclipse and the plugin to work without hiccups.