Last active
July 25, 2016 13:28
-
-
Save rbellamy/152d3e10ef5177b36fbe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin:EnterpriseRepositoryPlugin | |
class EnterpriseRepositoryPlugin implements Plugin<Gradle> { | |
private static String TERRADATUM_REPOSITORY_URL = "https://nexus.terradatum.com/content/groups/public" | |
void apply(Gradle gradle) { | |
// ONLY USE ENTERPRISE REPO FOR DEPENDENCIES | |
gradle.allprojects{ project -> | |
project.repositories { | |
// Remove all repositories not pointing to the enterprise repository url | |
all { ArtifactRepository repo -> | |
if (!(repo instanceof MavenArtifactRepository) || | |
repo.url.toString() != TERRADATUM_REPOSITORY_URL) { | |
project.logger.lifecycle "Repository ${repo.url} removed. Only $TERRADATUM_REPOSITORY_URL is allowed" | |
remove repo | |
} | |
} | |
// add the enterprise repository | |
maven { | |
name "Terradatum Nexus Repository" | |
url TERRADATUM_REPOSITORY_URL | |
} | |
} | |
} | |
} | |
} | |
allprojects { project -> | |
apply plugin: 'maven' | |
afterEvaluate { | |
task checkSonatypeProperties(overwrite: true) << { | |
project.logger.lifecycle "Overwrite checkSonatypeProperties" | |
} | |
uploadArchives { | |
repositories { | |
mavenDeployer { | |
snapshotRepository(url: 'https://nexus.terradatum.com/content/repositories/snapshots/') { | |
authentication(userName: 'deployment', password: 'password') | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment