Zixradoom
Zixradoom

Reputation: 977

Eclipse STS Gradle Plugin Dependency Breaks

I'm having an issue that you all might know how to solve. I pushed a new build for one of my projects to my Sonatype Nexus instance. Then I updated the dependencies of another project to use the new build version. After refreshing the project, Eclipse was complaining of the following issue.

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

I proceeded to build the project on the command line with "gradle build" and it succeeded in downloading the new artifact dependency. Again I went to my Eclipse project and refreshed it using the STS Gradle -> Refresh All, same issue. After surfing the web a bit I found some posts that said to try re-importing the project, but that did not work either. After a few more refreshes and a comp reboot I still had not gotten any where. Next I used "gradle cleanEclipse eclipse" and the issue was resolved in Eclipse but now it does not recognize it as a Gradle project.

If anyone knows of a fix that allows the new dependencies version to be imported with out resorting to generating the Eclipse files manually please let me and the rest of the SO community know.

EDIT: The full error is as follows:

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

I deleted the gradle cache dir and then rebuilt the project on the command line which restored the cache but, now Eclipse is claiming that it can no longer see any of the libs. I have refreshed the project and that did not update them either.

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

Build on the command line:

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

Upvotes: 2

Views: 3700

Answers (1)

王子1986
王子1986

Reputation: 3609

I resolved this issue by adding following to my build.gradle

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

Upvotes: 1

Related Questions