ryankennedy / swagger-jaxrs-doclet

Apache License 2.0
87 stars 136 forks source link

gradle : javadoc: error - invalid flag: -doctitle #54

Closed ugupta closed 10 years ago

ugupta commented 11 years ago

I am getting this error when I am trying to run this as a gradle task.

task apiDocs(type: Javadoc) {
   source = sourceSets.main.allJava
   options.docletpath = buildscript.configurations.classpath.files.asType(List)
   options.classpath = configurations.compile.files.asType(List)
   options.doclet = "com.hypnoticocelot.jaxrs.doclet.ServiceDoclet"
   options.addStringOption("d","build/swagger")
   options.addStringOption("apiVersion","v1")
   options.addStringOption("apiBasePath","https://demo.openmf.org/mifosng-provider/api/v1")
   options.addStringOption("docBasePath","http://localhost:8080")
 }
task createSwaggerDir(type: Directory) { dir = file('build/swagger') }
apiDocs.dependsOn("classes", "createSwaggerDir")

my current workaround is something like this

task apiDocs(type: Javadoc) {
   source = sourceSets.main.allJava
   options = new SwaggerOptions();
   options.docletpath = buildscript.configurations.classpath.files.asType(List)
   options.classpath = configurations.compile.files.asType(List)
   options.doclet = "com.hypnoticocelot.jaxrs.doclet.ServiceDoclet"
   options.addStringOption("d","build/swagger")
   options.addStringOption("apiVersion","v1")
   options.addStringOption("apiBasePath","https://demo.openmf.org/mifosng-provider/api/v1")
   options.addStringOption("docBasePath","http://localhost:8080")
 }

task createSwaggerDir(type: Directory) { dir = file('build/swagger') }
apiDocs.dependsOn("classes", "createSwaggerDir")

class SwaggerOptions extends org.gradle.external.javadoc.CoreJavadocOptions {
    File destDir; String header; String windowTitle;
    File getDestinationDirectory(){ return destDir;}
    void setDestinationDirectory(File destDir) { this.destDir = destDir; }
    String getHeader() { return header; }
    String getWindowTitle() { return windowTitle; }
    void setWindowTitle(String wt){}
    void setHeader(String s){}
    org.gradle.external.javadoc.StandardJavadocDocletOptions header(String d){}
    org.gradle.external.javadoc.StandardJavadocDocletOptions windowTitle(String s){}
    org.gradle.external.javadoc.MinimalJavadocOptions destinationDirectory(File f){}
 }

Tried searching and found that it should be the doclet problem. http://stackoverflow.com/questions/11034326/javadoc-does-not-recognize-doctitle-option-flag

Downloaded the code and tried extending doclet with

com.sun.tools.doclets.standard.Standard

and

com.sun.javadoc.Doclet

Didn't work

even tried changing LanguageVersion.JAVA_1_5 to LanguageVersion.JAVA_1_1

so at this point I am leaving it to the community here for suggestions.

jkovacs commented 11 years ago

We had the same issue and fixed it by simply setting the title property of the task to null:

 task apiDocs(type: Javadoc) {
   source = sourceSets.main.allJava
   title = null
   ...
 }
ugupta commented 11 years ago

OMG, can't believe this is the fix. Please close this issue. Thanks.