简体   繁体   中英

Exclude thrift generated files from javadoc

My build.gradle has the following task which is pretty standard.

task javadocJar(type: Jar, dependsOn: javadoc) {
    classifier = 'javadoc'
    from javadoc.destinationDir
}

However I keep getting javadoc lint errors for my thrift generated files. Adding an exclude like exclude '**/gen-java/**' to the end of a task does not seem to work. How can i tell this gradle task to stop looking at my thrift-generated java files?

You could tweak the javadoc task added by the java plugin

javadoc {
    source = sourceSets.main.allJava.matching {
       exclude '**/gen-java/**'
    }
}

If you're publishing javadoc & sources jars you might be interested in the nebula.javadoc-jar and nebula.source-jar plugins which save a bit of boilerplate each time in your build scripts

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM