![](/img/trans.png)
[英]How to add Gradle nature for Gradle 2.0 to the Eclipse project
[英]Remove gradle nature from eclipse project
我只是鏡像了一個使用maven的repo,但是當手動編輯maven模塊的.project和.classpath文件時,我不小心使用了gradle而不是maven。 我已經手動將文件更改為maven並且已經擺脫了我可以找到的所有與gradle相關的文本,但是eclipse在所有模塊上都給了我這個錯誤
缺少Gradle項目配置文件:.settings / org.eclipse.buildship.core.prefs EssentialsX未知Gradle項目配置標記
我該如何解決這個錯誤?
此外,這是特定的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>
這是.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>
感謝您的時間!
要刪除項目中的自然,請轉到它的文件夾和.project
文件中的<natures>
remove <nature>org.eclipse.buildship.core.gradleprojectnature</nature>
。 這將刪除圖標(如果您顯示了圖標 - 您可以選擇不顯示圖標,即使應用了性質)和右鍵單擊上下文菜單gradle條目。
此外,在.classpath
文件中刪除行<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
。 這會將條目導出到運行時類路徑。
然后,您可以刪除構建和設置gradle文件,包裝文件(如果有),.bat文件, .settings
文件夾下的org.eclipse.buildship.core.prefs
和.externalToolBuilder
如果適用)。
由於你已經搞亂了文件並且仍然收到錯誤,我建議你重新應用Eclipse的gradle性質(使用buildship導入器),並且當所有錯誤得到解決時,如上所述。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.