Eclipse STS Gradle插件依赖性中断

时间:2014-11-05 02:48:54

标签: java eclipse gradle spring-tool-suite gradle-eclipse

我遇到了一个你可能都知道如何解决的问题。我将我的一个项目的新构建推送到我的Sonatype Nexus实例。然后我更新了另一个项目的依赖项以使用新的构建版本。刷新项目后,Eclipse抱怨以下问题。

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

我继续使用“gradle build”在命令行上构建项目,并成功下载了新的工件依赖项。我再次进入我的Eclipse项目并使用STS Gradle -> Refresh All同样的问题刷新它。在浏览网页后,我发现了一些帖子,试图重新导入项目,但这也没有用。经过几次更新和重新启动后,我仍然没有得到任何地方。接下来我使用了“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声称它不再能看到任何库。我已经刷新了项目,但也没有更新它们。

Gradle Build 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'
}

在命令行上构建:

Zixradoom@ZIXRADOOMSLAPTOP /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

1 个答案:

答案 0 :(得分:1)

我通过在build.gradle中添加以下内容来解决此问题

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