我使用UMLGraph为Intellij IDEA中项目中的每个类创建类图。我/app/build.gradle
的代码是:
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: build) {
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: "{path_to android jar}",
sourcepath: file('src/main/java'),
packagenames: '*',
destdir: "{path_to_doc_dir}",
private: 'true',
docletpath: configurations.umljavadoc.asPath,
charset: 'UTF-8',
encoding: 'UTF-8',
docencoding: 'UTF-8') {
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: 'http://java.sun.com/j2se/1.5.0/docs/guide/javadoc/doclet/spec')
param(name: '-link', value: 'http://java.sun.com/j2se/1.5/docs/api')
}
}
}
else
{
print("!!! Cannot find source path !!!");
}
}
}
}
如果我从控制台启动gradlew javadoc
一切都很好,它会创建并插入所有图表。但是,如果我尝试使用IDE(Tools - Generate Javadoc...
)生成文档,则不会创建图表。
如果我尝试从javadoc
运行任务Gradle view
,它会插入文本占位符而不是真实的图表。
问题是:如何使用对话框Tools - Generate Javadoc...
生成带有UMLGraph图表的javadoc?
答案 0 :(得分:1)
在"其他命令行参数"在Generate JavaDoc对话框中,您可以添加指向doclet类的-docletpath和-doclet参数,然后添加特定于doclet的参数。