java - Eclipse STS Gradle 插件依赖关系中断

标签 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 刷新它,同样的问题。在网上冲浪了一下后,我发现一些帖子说要尝试重新导入该项目,但这也没有用。经过几次刷新和 comp 重新启动后,我仍然没有得到任何地方。接下来,我使用了“gradle cleanEclipse eclipse”,问题在 Eclipse 中得到了解决,但现在它无法将其识别为 Gradle 项目。

如果有人知道允许导入新依赖项版本而无需手动生成 Eclipse 文件的修复程序,请告诉我和 SO 社区的其他成员。

编辑: 完整错误如下:

“Spirit”项目缺少所需的库:“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

最佳答案

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

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

关于java - Eclipse STS Gradle 插件依赖关系中断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26748915/

相关文章:

gradle - android studio 0.8.1:Gradle项目同步失败。基本功能(例如,编辑,调试)将无法正常运行

java - 在 weblogic 12.2.1 上部署 Spring Boot 2 应用程序时创建名称为 'httpPutFormContentFilter' 的 bean 时出错

java - 第二次加载后位图大小超出虚拟机预算

php - Aptana 3 在检测到代码中的任何错误后展开整个文件

eclipse - 如何在 Chrome 中运行 Eclipse 的动态 Web 项目?

eclipse - Tomcat 服务器在 45 秒内未启动

android - 响应 304 : Not Modified has no content

android - 如何为android gradle项目设置口味?神秘的重复类错误

java - Android 错误膨胀类 <unknown>

java - 防止 Infinispan 集群