Reputation: 21457
Here is a sample top-level build.gradle
configured with Artifactory:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:x.x.x"
classpath 'com.android.tools.build:gradle:x.x.x'
}
}
allprojects {
apply plugin: 'com.jfrog.artifactory'
}
artifactory {
contextUrl = "${artifactory_contextUrl}"
//... standard artifactory plugin auto-generated from web interface
}
I would like com.android.tools.build:gradle:x.x.x
and to be served from an Artifactory remote, rather than from jcenter
or the Google Maven Repository since these are blocked by a hostile workplace proxy.
However, it seems that the artifactory
Gradle plugin is only available after the buildscript
closure has been applied. How can I get the other buildscript
dependencies to be served from Artifactory?
Upvotes: 2
Views: 168
Reputation: 21457
You can make simple Maven remote repositories to serve the buildscript
dependencies. Since these remote repositories simply mirror the public repositories, you can make the access anonymous. This means that at the time for executing the buildscript
closure, there is no need for configuring artifactory_user
and artifactory_contextUrl
.
A sample build.gradle
would look something like this:
buildscript {
repositories {
maven {
url "http:///example.com:8082/artifactory/list/jcenter/"
}
maven {
url "http://example.com:8082/artifactory/list/google-remote/"
}
}
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:x.x.x"
classpath 'com.android.tools.build:gradle:x.x.x'
}
}
where google-remote
is the name (repository key) of the remote repository mirroring the Google Maven Repository you have configured yourself.
As for configuring the Artifactory remote for the Google Maven Repository itself, the address is simply maven.google.com
as per the picture below:
Upvotes: 3