Skip to content

Instantly share code, notes, and snippets.

@civitaspo
Created July 13, 2017 05:44
Show Gist options
  • Save civitaspo/4ed281fb942826fc3a4b62637ef38fde to your computer and use it in GitHub Desktop.
Save civitaspo/4ed281fb942826fc3a4b62637ef38fde to your computer and use it in GitHub Desktop.
javadoc を gh-pages で運用する
plugins {
id "java"
id "checkstyle"
}
group 'io.github.civitaspo'
version '0.0.1'
sourceCompatibility = 1.8
repositories {
mavenCentral()
maven { url "http://repo.hortonworks.com/content/groups/public/" }
}
configurations {
provided
}
dependencies {
// https://mvnrepository.com/artifact/commons-cli/commons-cli
compile group: 'commons-cli', name: 'commons-cli', version: '1.4'
// https://mvnrepository.com/artifact/org.slf4j/slf4j-api
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
// https://mvnrepository.com/artifact/com.google.inject/guice
compile group: 'com.google.inject', name: 'guice', version: '4.1.0'
// https://mvnrepository.com/artifact/com.google.guava/guava
compile group: 'com.google.guava', name: 'guava', version: '22.0'
// https://mvnrepository.com/artifact/org.yaml/snakeyaml
compile group: 'org.yaml', name: 'snakeyaml', version: '1.18'
// hortonworks
compile group: 'org.apache.hadoop', name: 'hadoop-client', version: '2.7.3.2.5.0.0-1245'
compile group: 'org.apache.hive', name: 'hive-metastore', version: '2.1.0.2.5.0.0-1245'
// For Docs
// https://mvnrepository.com/artifact/nl.talsmasoftware/umldoclet
compile group: 'nl.talsmasoftware', name: 'umldoclet', version: '1.0.11'
// https://mvnrepository.com/artifact/net.sourceforge.plantuml/plantuml
compile group: 'net.sourceforge.plantuml', name: 'plantuml', version: '8059'
testCompile group: 'junit', name: 'junit', version: '4.12'
}
task classpath(type: Copy, dependsOn: ["checkstyle", "jar"]) {
doFirst { file("classpath").deleteDir() }
from (configurations.runtime - configurations.provided + files(jar.archivePath))
into "classpath"
}
clean { delete "classpath" }
checkstyle {
configFile = file("${project.rootDir}/config/checkstyle/checkstyle.xml")
toolVersion = '7.8.2'
}
task checkstyle(dependsOn: ["checkstyleMain", "checkstyleTest"]) {
// For showing warns every time.
delete checkstyle.reportsDir
}
def ghPagesRoot = "docs"
def autodocDir = "$ghPagesRoot/autogen"
task autodoc(type: Javadoc, dependsOn: ["classpath"]) {
doFirst { file(autodocDir).delete() }
source = sourceSets.main.allJava
classpath = files(file("classpath").listFiles())
destinationDir = file(autodocDir)
options.docletpath = file("classpath").listFiles()
options.doclet = "nl.talsmasoftware.umldoclet.UMLDoclet"
options.addStringOption 'umlBasePath', autodocDir
options.addStringOption 'umlIncludeHyperlinks', 'true'
finalizedBy 'generateUML'
}
task generateUML(type: JavaExec) {
main = 'net.sourceforge.plantuml.Run'
classpath = files(file("classpath").listFiles())
args "$ghPagesRoot/**/*.puml"
}
task plantuml(type: JavaExec, dependsOn: ['classpath']) {
main = 'net.sourceforge.plantuml.Run'
classpath = files(file("classpath").listFiles())
if (project.hasProperty("args")) {
args project.args.split('\\s+')
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment