Created
June 20, 2013 16:14
-
-
Save akhikhl/5824197 to your computer and use it in GitHub Desktop.
gradle snippet: sources and javadoc jars for every subproject
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
/* Add this to the parent "build.gradle" to enable xyz-sources.jar and xyz-javadoc.jar generation | |
* for every java and groovy subproject of the given parent project. | |
* The script tolerates non-java subprojects. | |
*/ | |
subprojects { | |
afterEvaluate { | |
if(tasks.findByName("classes")) { | |
task sourcesJar(type: Jar, dependsOn: classes) { | |
classifier = 'sources' | |
from sourceSets.main.allSource | |
} | |
artifacts { | |
archives sourcesJar | |
} | |
} | |
if(tasks.findByName("javadoc")) { | |
task javadocJar(type: Jar) { | |
dependsOn javadoc | |
classifier = 'javadoc' | |
from javadoc.destinationDir | |
if(tasks.findByName("groovydoc")) { | |
dependsOn groovydoc | |
from groovydoc.destinationDir | |
} | |
} | |
artifacts { | |
archives javadocJar | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment