2

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

"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 声称它不再能看到任何库。我已经刷新了项目,但也没有更新它们。

Gradle 构建片段:

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
4

1 回答 1

1

我通过将以下内容添加到我的 build.gradle 解决了这个问题

repositories {
    mavenLocal()
    maven { url "http://localrepo:8081/artifactory/libs-release" }
}
于 2015-04-17T06:39:44.710 回答