I'm exploring Gradle and quite new to build tools & Java in general. I was trying to open a gradle project in a new Eclipse workspace, but I need to give build paths manually each time I open a new project. The .classpath folder exists with the required build paths but Eclipse seems to be not using it initially. Do we need to make the eclipse plugin use the .classpath? It does not do this by default?
Any help is highly appreciated. Thank you.
CodePudding user response:
I have had a few problems with gradle and eclipse...
In eclipse
Close your project
on the command line in the root of the project - have a look at these files:
.classpath
it should have an entry
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
This file should also exist
.settings/org.eclipse.buildship.core.prefs
with the contents
connection.project.dir=
eclipse.preferences.version=1
.project
?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>w-temp</name>
<comment>Project temp created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>
Make sure those files and entries are there, save them.
Re-open project