I have the following custom repository URL for a plugin that I'm trying to load in my application:
https://server.com/artifactory/plugins-release-local/abc/pluginXYZ/r181/pluginXYZ-r181.jar
In my build.gradle
file:
...
repositories {
mavenLocal()
maven { url 'https://repo.grails.org/grails/core' }
//custom Artifactory repository
maven { url 'https://server.com/artifactory/plugins-release-local' }
}
...
dependencies {
compile "abc:pluginXYZ:r181"
}
Next, attempt to compile:
me@workstation ~/my_app
$ grails compile
[buildinfo] Not using buildInfo properties file for this build.
BUILD SUCCESSFUL
Total time: 3.906 secs
Error |
Could not resolve all dependencies for configuration ':testRuntime'. Type 'gradle dependencies' for more information
Next, attempt to diagnose dependency issues:
me@workstation ~/my_app
$ ./gradlew dependencies --info | grep missing
Resource missing. [HTTP HEAD: https://repo.grails.org/grails/core/abc/pluginXYZ/r181/wetkit-r181.pom]
Resource missing. [HTTP HEAD: https://repo.grails.org/grails/core/abc/pluginXYZ/r181/wetkit-r181.jar]
In this case, pluginXYX
will never be found on repo.grails.org
. How can I limit the resolution to my custom Artifactory repository?
Here's my solution. I essentially reworked the maven closure and provided an artifactUrls attribute.
...
repositories {
mavenLocal()
maven {
url "https://repo.grails.org/grails/core"
artifactUrls "https://server.com/artifactory/plugins-release-local"
}
}
...
dependencies {
...
compile "abc:pluginXYZ:r181"
}
...
Also: Example 23.30. Adding additional Maven repositories for JAR files