Created
February 3, 2014 22:29
-
-
Save mikeholler/8793787 to your computer and use it in GitHub Desktop.
Publish binary, source, and javadoc jars to maven repository requiring username/password credentials.
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: 'java' | |
apply plugin: 'maven-publish' | |
task sourceJar(type: Jar) { | |
// Specifies a JAR that contains source code from the library. | |
from sourceSets.main.allJava | |
} | |
task fatJar(type: Jar, dependsOn: build) { | |
// Creates a JAR that contains all dependencies in addition to the library. | |
// from http://fw-geekycoder.blogspot.com/2011/11/how-to-create-jar-with-dependencies-in.html | |
from sourceSets.main.output | |
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } | |
manifest { attributes 'Main-Class': 'test.Main' } | |
} | |
task javadocJar(type: Jar, dependsOn: javadoc) { | |
// Specifies a JAR that contains Javadoc for the library. | |
from javadoc.destinationDir | |
} | |
publishing { | |
publications { | |
mavenJava(MavenPublication) { | |
from components.java | |
artifact sourceJar { | |
classifier "sources" | |
} | |
artifact javadocJar { | |
classifier "javadoc" | |
} | |
artifact fatJar { | |
classifier "all" | |
} | |
} | |
} | |
repositories { | |
maven { | |
credentials { | |
username mavenUser | |
password mavenPass | |
} | |
url mavenVgbioUrl | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment