Skip to content

Instantly share code, notes, and snippets.

@pintowar
Last active June 3, 2017 20:10
Show Gist options
  • Select an option

  • Save pintowar/f31417547ade4bf62dfbf8e6c036b4bc to your computer and use it in GitHub Desktop.

Select an option

Save pintowar/f31417547ade4bf62dfbf8e6c036b4bc to your computer and use it in GitHub Desktop.
Show UML Class Diagrams on Javadoc
//
// Override the javadoc task to use umlgraph doclet. This depends on the presence
// of GraphViz on the path in your environment (http://www.graphviz.org)
//
allprojects {
configurations {
umljavadoc
}
dependencies {
umljavadoc 'org.umlgraph:umlgraph:5.6'
}
//
// While javadoc is not typically dependent on compilation, the compile steps
// sometimes generate some sources that we wish to have in the Javadoc.
//
task javadoc(overwrite: true, dependsOn: compileJava) {
setDescription('Generates Javadoc API documentation with UMLGraph diagrams')
setGroup(JavaBasePlugin.DOCUMENTATION_GROUP)
doLast {
def javaFilePath = file('src/main/java')
if (javaFilePath.exists()) {
ant.javadoc(classpath: (configurations.runtime + configurations.provided).asPath,
sourcepath: file('src/main/java'),
packagenames: '*',
destdir: "${docsDir}/javadoc",
private: 'true',
docletpath: configurations.umljavadoc.asPath) {
doclet(name: 'org.umlgraph.doclet.UmlGraphDoc') {
param(name: '-inferrel')
param(name: '-inferdep')
param(name: '-qualify')
param(name: '-postfixpackage')
param(name: '-hide', value: 'java.*')
param(name: '-collpackages', value: 'java.util.*')
param(name: '-nodefontsize', value: '9')
param(name: '-nodefontpackagesize', value: '7')
param(name: '-link', value: 'https://docs.oracle.com/javase/8/docs/api')
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment