简体   繁体   English

从eclipse项目中删除gradle nature

[英]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. 我只是镜像了一个使用maven的repo,但是当手动编辑maven模块的.project和.classpath文件时,我不小心使用了gradle而不是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 我已经手动将文件更改为maven并且已经摆脱了我可以找到的所有与gradle相关的文本,但是eclipse在所有模块上都给了我这个错误

Missing Gradle project configuration file: .settings/org.eclipse.buildship.core.prefs EssentialsX Unknown Gradle Project Configuration Marker 缺少Gradle项目配置文件:.settings / org.eclipse.buildship.core.prefs EssentialsX未知Gradle项目配置标记

How can I solve this error? 我该如何解决这个错误?

Also, here is this specific maven module's .project file 此外,这是特定的maven模块的.project文件

<?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文件

<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! 感谢您的时间!

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> . 要删除项目中的自然,请转到它的文件夹和.project文件中的<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. 这将删除图标(如果您显示了图标 - 您可以选择不显示图标,即使应用了性质)和右键单击上下文菜单gradle条目。

Also, in the .classpath file remove the line <classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/> . 此外,在.classpath文件中删除行<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. 然后,您可以删除构建和设置gradle文件,包装文件(如果有),.bat文件, .settings文件夹下的org.eclipse.buildship.core.prefs.externalToolBuilder如果适用)。

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. 由于你已经搞乱了文件并且仍然收到错误,我建议你重新应用Eclipse的gradle性质(使用buildship导入器),并且当所有错误得到解决时,如上所述。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM