Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove gradle nature from eclipse project

I just mirrored a repo that uses maven, however when manually editing the maven modules' .project and .classpath files I accidentally used gradle instead of maven. I've since changed the files manually to maven and have gotten rid of all gradle related text I could find, however eclipse is giving me this error on all modules

Missing Gradle project configuration file: .settings/org.eclipse.buildship.core.prefs EssentialsX Unknown Gradle Project Configuration Marker

How can I solve this error?

Also, here is this specific maven module's .project file

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>Essentials</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.m2e.core.maven2Builder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.m2e.core.maven2Nature</nature>
        <nature>org.eclipse.jdt.core.javanature</nature>
    </natures>
</projectDescription>

And here is the .classpath file

<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="src" path="test"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="output" path="bin"/>
</classpath>

Thank you for your time!

like image 493
C_Neth Avatar asked Nov 30 '16 09:11

C_Neth


People also ask

What is ADD Gradle nature in Eclipse?

Add Gradle support to existing Eclipse project. To convert a Java project to use Gradle, select Gradle Add Gradle Nature from the context menu of the project. Run the 'gradle init' task to create the initial Gradle files, in case you do not have them yet.

Where is Gradle properties in Eclipse?

After generating the Eclipse project files, you can import the project into a Eclipse workspace. It is important to add the GRADLE_USER_HOME variable in Eclipse: Window->Preferences->Java->Build Path->Classpath Variable. Set it to the path of the ~/. gradle folder in your home directory (e.g. /home/<user_name>/.

How do I run a clean build in Gradlew Eclipse?

Now type “build” Gradle command in that Text editor as shown below. 9. Click on “Apply” button to apply our changes. Then click on “Run” button to start our Gradle build commnad “gradle build” Observe the Eclipse IDE Console log.


1 Answers

To remove a nature from a project go to it's folder and in its .project file, under <natures> remove <nature>org.eclipse.buildship.core.gradleprojectnature</nature>. This will remove the icon (if you had it shown - you can choose to not show an icon even if the nature is applied) and the right click context menu gradle entry.

Also, in the .classpath file remove the line <classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>. This exports the entry to the runtime classpath.

You can then delete the build and settings gradle files, the wrapper files if you had them, the .bat file, the org.eclipse.buildship.core.prefs under .settings folder, and the .externalToolBuilder if applicable.

Since you already messed with the files and still getting the error I suggest you reapply the gradle nature from Eclipse (use the buildship importer) and when all the errors are resolved do as described above.

like image 137
Mark Avatar answered Sep 28 '22 17:09

Mark