提问者:小点点

Gradle 无法在私有 nexus 存储库中找到依赖项


我在获取 gradle 时遇到了麻烦,无法找到我放入私有 nexus 存储库中的依赖项。依赖性在maven中,但我似乎也无法让它在那里找到它。我确实把它放进了我的nexus存储库,位置 http://nexus.hq.chris.com/content/repositories/emoji4j/

Could not resolve all dependencies for configuration ':business:compile'.
> Could not find com.kcthota:emoji4j:6.0.
  Searched in the following locations:
      http://nexus.hq.chris.com/content/groups/public/com/kcthota/emoji4j/6.0/emoji4j-6.0.pom
      http://nexus.hq.chris.com/content/groups/public/com/kcthota/emoji4j/6.0/emoji4j-6.0.jar
      file:/Users/chris/.m2/repository/com/kcthota/emoji4j/6.0/emoji4j-6.0.pom
      file:/Users/chris/.m2/repository/com/kcthota/emoji4j/6.0/emoji4j-6.0.jar
  Required by:

建筑格拉德尔·斯尼佩特

dependencies {
    // https://mvnrepository.com/artifact/com.kcthota/emoji4j
    compile group: 'com.kcthota', name: 'emoji4j', version: '6.0'
}



buildscript {
    repositories {
        maven {
            url "http://nexus.hq.chris.com/content/groups/public/"
        }
        maven { url "https://repo1.maven.org/maven2/" }
        maven { url "http://nexus.hq.chris.com/content/repositories/emoji4j/" }
        mavenCentral()
    }
    dependencies {
        classpath 'com.jcraft:jsch:0.1.54'
    }
}

有谁知道我如何让 gradle 在 http://nexus.hq.chris.com/content/groups/public/ 和 http://nexus.hq.chris.com/content/repositories/emoji4j/ 中查找我的所有依赖项?我需要其他依赖项的 http://nexus.hq.chris.com/content/groups/public/ 位置。我尝试在那里添加它,但我只有对该存储库的读取访问权限。

另一个可接受的解决方案是让gradle在http://nexus.hq.chris.com/content/groups/public/和maven central中查找它。任何帮助都将不胜感激。


共1个答案

匿名用户

我认为您可能混淆了构建脚本和应用程序依赖关系的依赖关系。

您已经配置了构建脚本存储库,但还需要配置应用程序存储库:

// build.gradle

repositories {
    maven {
        url "http://nexus.hq.chris.com/content/groups/public/"
    }
    maven { url "https://repo1.maven.org/maven2/" }
    maven { url "http://nexus.hq.chris.com/content/repositories/emoji4j/" }
    mavenCentral()
}