gradle can't resolve nexus dependency

ⅰ亾dé卋堺 提交于 2019-12-24 21:28:41

问题


I have a dependency I'd like to include from a local nexus. I've seen several related problems that all say to do something like

apply plugin: "java"
apply plugin: "maven"

repositories {
    maven {
        url "http://my.url.com/"
    }
}

dependencies {  
    compile "name:id:version"
}

I can access the nexus fine via web but when I try the above, I end up with a error message

Could not resolve: name:id:version

Any help would be greatly appreciated.


回答1:


I found my problem. There were transitive dependencies I didn't catch as I was initially building from Eclipse without the --stacktrace option. I modified the build script such that

compile("name:id:version") {
    exclude group: "another-name", module: "its-module"
    // other dependencies to exclude ...
}



回答2:


If by local repository you mean your local computer repository, then to ask Gradle to lookup dependencies from the local maven repository you should explicitly tell him to do so like this:

repositories {
  mavenLocal()
}

Gradle is not like maven and is not using the local repository of the maven to cache downloaded artifacts. From the Gradle points of view, the local maven repository is also like other repositories.



来源:https://stackoverflow.com/questions/47906979/gradle-cant-resolve-nexus-dependency

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!