2014-11-05 104 views
2

我遇到了一個您可能都知道如何解決的問題。我把我的一個項目的新版本推到了我的Sonatype Nexus實例中。然後我更新了另一個項目的依賴關係,以使用新的構建版本。刷新項目之後,Eclipse正在抱怨以下問題。Eclipse STS Gradle插件依賴關係突破

"Illegal entry in Gradle Dependencies: c:/Users/..." 

我開始在命令行上用「gradle build」構建項目,併成功下載了新的工件依賴項。再次,我去了我的Eclipse項目,並使用STS Gradle -> Refresh All刷新它,同樣的問題。在網上衝浪之後,我發現有些帖子說要嘗試重新導入項目,但這也不起作用。經過幾次刷新和comp重新啓動後,我仍然沒有得到任何地方。接下來我使用了「gradle cleanEclipse eclipse」,這個問題在Eclipse中得到了解決,但現在它並不認爲它是一個Gradle項目。

如果有人知道一個修復程序允許導入新的依賴項版本,而不是手動生成Eclipse文件,請讓我和其他SO社區知道。

編輯: 完整的錯誤如下:

Project 'Spirit' is missing required library: 'C:\Users\Zixradoom\Documents\bin\eclipse\eclipse\unresolved dependency - org.apache.logging.log4j log4j-core 2.0.2'

我刪除了gradle這個緩存目錄,然後重建其恢復高速緩存,但是,現在的Eclipse聲稱在命令行上項目它不能再看到任何庫。我刷新了這個項目,但沒有更新它們。

搖籃構建Snipet:

repositories { 
    maven { 
    credentials { 
     username mavenUser 
     password mavenPassword 
    } 
    url "https://www.example.com/nexus/content/groups/public" 
    } 
} 

dependencies { 
    testCompile group: 'junit', name: 'junit', version: '4.11' 
    compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.0.2' 
    compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.0.2' 
    compile group: 'com.s2d', name: 'Cognition', version: '1.0.0.5' 
} 

構建在命令行上:

[email protected] /C/Users/Zixradoom/Documents/localGit/Spirit (master) 
$ gradle build 
:compileJava 
Download https://www.example.com/nexus/content/groups/public/org/apache/logging/log4j/log4j-api/2.0.2/log4j-api-2.0.2.pom 
Download https://www.example.com/nexus/content/groups/public/org/apache/logging/log4j/log4j/2.0.2/log4j-2.0.2.pom 
Download https://www.example.com/nexus/content/groups/public/org/apache/apache/9/apache-9.pom 
Download https://www.example.com/nexus/content/groups/public/org/apache/logging/log4j/log4j-core/2.0.2/log4j-core-2.0.2.pom 
Download https://www.example.com/nexus/content/groups/public/com/s2d/Cognition/1.0.0.5/Cognition-1.0.0.5.pom 
Download https://www.example.com/nexus/content/groups/public/org/apache/logging/log4j/log4j-api/2.0.2/log4j-api-2.0.2.jar 
Download https://www.example.com/nexus/content/groups/public/org/apache/logging/log4j/log4j-core/2.0.2/log4j-core-2.0.2.jar 
Download https://www.example.com/nexus/content/groups/public/com/s2d/Cognition/1.0.0.5/Cognition-1.0.0.5.jar 
:processResources UP-TO-DATE 
:classes 
:jar 
:assemble 
:compileTestJava UP-TO-DATE 
:processTestResources UP-TO-DATE 
:testClasses UP-TO-DATE 
:test UP-TO-DATE 
:check UP-TO-DATE 
:build 

BUILD SUCCESSFUL 

Total time: 16.38 secs 
+0

不幸的是,你切斷了我的錯誤ssage。但我猜'非法進入'是一個未解決的依賴關係?我幾乎可以肯定,gradle STS工具只給出了這個特定情況下的消息。如果你給出了整個信息,它仍然會有所幫助。那個特定的條目指向我,也幫助你找出解決方法。你必須確定這個依賴關係來自何處,以及爲什麼它沒有得到解決。 – Kris 2014-11-05 17:32:21

+0

@Zixradoom,給出依賴聲明的代碼片段並確認項目從命令行生成OK。 – 2014-11-11 03:42:28

+0

我從頭開始......使用操作系統。它現在有效。 – Zixradoom 2015-05-11 23:57:45

回答

1

我加入解決了這個問題,下面我的build.gradle

repositories { 
    mavenLocal() 
    maven { url "http://localrepo:8081/artifactory/libs-release" } 
}