I have a Java project that I am managing with Gradle. Such project will be composed by multiple small libraries, which are developed independently one another, and a "leaf" project whose goal is just to depend on the latest stable version of each library, package everything in a fat Jar and provide aggregated documentation.
Each library will be uploaded as a separate artifact on Maven Central.
In order to test the feasibility of such configuration, I have written a very simple project which depends on GNU Trove4j. I'd like to be able to generate a Javadoc for this project that includes both my source code's and Trove4j's code, but so far I have had no success.
My idea would be to import dependencies' sources from Central as part of Gradle's sourceSet, but I have no idea on how to do it.
One way to accomplish this would be to add all the dependencies you want documented to a separate configuration that you then add to the javadoc
task. Here is a quick example with a couple of simple libraries:
configurations {
doc {
transitive false
}
}
dependencies {
doc 'com.google.code.gson:gson:2.3.1:sources'
doc 'commons-collections:commons-collections:3.2.1:sources'
}
javadoc {
source configurations.doc.collect { zipTree(it) }
include '**/*.java'
options.addStringOption('Xdoclint:none', '-quiet')
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With