Java :Maven Repositories
https://www.safaribooksonline.com/library/view/gradle-beyond-the/9781449373801/ch04.html
Since a Maven repository is nothing more than a website containing downloadable POM files and modules in a predictable directory structure, declaring a Maven repository in Gradle begins with telling Gradle the URL of the repo. '
The most common Maven repository http://repo1.maven.org/maven2/ ( to avoid scripting that URL directly into your build).
Gradle: Declaring the Central repository
repositories {
mavenCentral()
}
Other open-source Maven repositories exist on the Internet, Sonatype’s Nexus and JFrog’s Artifactory
Gradle : Declaring Maven repositories in general
repositories {
maven {
url = 'http://download.java.net/maven/2'
}
maven {
name = 'JBoss Repo' //optional name
url = 'https://repository.jboss.org/nexus/content/repositories/releases'
}
}
To download build artifacts from a mirrored copy of the repo somewhere else in the network
Gradle: Setting the artifact URL as distinct from the default POM URL
repositories {
// Overriding artifacts for an internal repo
maven {
url = 'http://central.megacorp.com/main/repo'
artifactUrls = [ 'http://dept.megacorp.com/local/repo' ]
}
// Obtain Maven Central artifacts locally
mavenCentral artifactUrls: ['http://dept.megacorp.com/maven/central']
}
-----------------
No comments:
Post a Comment