8/18/2016

Generate javadoc using gradle

In your build.gradle file, adding the below snipet of code can generate the java doc of your module

configurations {
    javadocDeps
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile "com.android.support:support-annotations:${rootProject.ext.androidSupportSdkVersion}"    javadocDeps "com.android.support:support-annotations:${rootProject.ext.androidSupportSdkVersion}"}

task generateJavadocs(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
    classpath += project.files(android.getBootClasspath()
            .join(File.pathSeparator))

    classpath += configurations.javadocDeps    failOnError false    destinationDir = file("../javaDoc/")
    exclude {
        it.file.path.contains('aidl')
    }
}


No comments:

Post a Comment