Last active
August 17, 2017 18:06
-
-
Save rherrick/8d1f95bf28636dc110353a887d8f1326 to your computer and use it in GitHub Desktop.
External Gradle configuration
This file contains 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: "jacoco" | |
ext.propertyWithDefault = { String name, def value -> | |
hasProperty(name) ? property(name) : value | |
} | |
dependencyManagement.imports { | |
mavenBom "org.nrg:parent:${vXnat}" | |
} | |
repositories { | |
mavenLocal() | |
mavenCentral() | |
jcenter() | |
maven { | |
url 'http://www.dcm4che.org/maven2' | |
name 'dcm4che Maven Repository' | |
} | |
maven { | |
url 'https://nrgxnat.jfrog.io/nrgxnat/libs-release' | |
name 'XNAT Release Repository' | |
} | |
maven { | |
url 'https://nrgxnat.jfrog.io/nrgxnat/libs-snapshot' | |
name 'XNAT Snapshot Repository' | |
} | |
maven { | |
url 'https://nrgxnat.jfrog.io/nrgxnat/ext-release' | |
name 'XNAT External Release Repository' | |
} | |
} | |
sourceCompatibility = 1.7 | |
targetCompatibility = 1.7 | |
if (JavaVersion.current().isJava8Compatible()) { | |
allprojects { | |
tasks.withType(Javadoc) { | |
options.addStringOption('Xdoclint:none', '-quiet') | |
} | |
} | |
if (hasProperty("rt.17.jar")) { | |
// Solution for bootstrap classpath warning and possible issues with compatibility with 1.7 libraries | |
// was taken from this post on discuss.gradle.org: http://bit.ly/24xD9j0 | |
def rt17jar = property "rt.17.jar" | |
logger.info "Using ${rt17jar} as the bootstrap class path jar." | |
gradle.projectsEvaluated { | |
tasks.withType(JavaCompile) { | |
options.fork = true | |
options.compilerArgs << "-XDignore.symbol.file" | |
options.bootClasspath = rt17jar as String | |
} | |
} | |
} else { | |
logger.warn "No value was set for the rt.17.jar build property, using the default bootstrap class path. You should consider setting rt.17.jar to indicate a jar file containing the Java 1.7 run-time library:\n" | |
logger.warn " ./gradlew -Prt.17.jar=rt-1.7.0_45.jar clean test\n" | |
} | |
} | |
jacoco { | |
toolVersion = dependencyManagement.importedProperties['jacoco.version'] | |
} | |
jacocoTestReport { | |
reports { | |
xml.enabled = false | |
csv.enabled = false | |
html.destination file("${buildDir}/jacocoHtml") | |
} | |
} | |
task sourceJar(type: Jar, dependsOn: classes) { | |
classifier "sources" | |
from sourceSets.main.allSource | |
} | |
task javadocJar(type: Jar, dependsOn: javadoc) { | |
classifier "javadoc" | |
from javadoc.destinationDir | |
} | |
publishing.repositories { | |
maven { | |
credentials { | |
// These properties must be set in the ~/.gradle/gradle.properties file or passed on the Gradle command | |
// line in the form -PrepoUsername=foo -PrepoPassword=bar. | |
username = propertyWithDefault 'repoUsername', 'username' | |
password = propertyWithDefault 'repoPassword', 'password' | |
} | |
url = project.version.endsWith('-SNAPSHOT') ? "https://nrgxnat.jfrog.io/nrgxnat/libs-snapshot-local" : "https://nrgxnat.jfrog.io/nrgxnat/libs-release-local" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment