blob: a9d78de69ac7e7ea39ea42826e26e1582db31702 [file] [log] [blame] [raw]
// child script to publish to a maven repo
apply plugin: 'maven-publish'
// allow javadoc archive on Java 8 even if the javadoc isn't complete
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
// source jar
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.java.srcDirs
}
// javadoc jar
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from 'build/docs/javadoc'
}
publishing {
publications {
maven(MavenPublication) {
artifact remap.outputJar
artifact sourcesJar
artifact javadocJar
repositories {
maven {
// credentials
credentials {
username System.getenv("sonatypeUsername")
password System.getenv("sonatypePassword")
}
// url depends on version
if (version.endsWith('-SNAPSHOT')) {
url = 'http://repo.glowstone.net/content/repositories/snapshots/'
} else {
url = 'http://repo.glowstone.net/content/repositories/releases/'
}
}
}
}
}
}