Javadoc/Doclet with Gradle does not find flag doctitle


I am using gradle with javadoc-doclets, and I run always into the next error:

I have the next tasks in the build.gradle:

task myJavadocs(type: Javadoc) {
    source = sourceSets.main.allJava
 classpath = configurations.compile
 destinationDir = file("./doc/")
    task myDoclet(type: Javadoc, dependsOn: myJavadocs) {
 source = sourceSets.main.allJava
 options.doclet = 'Doclet2'
 classpath = configurations.compile
 List pathList = new ArrayList();
 options.docletpath = pathList

The thing is that, when I run the task “myJavaDocs”, it just runs perfectly, without problems. But when I run the one to generate my the documentation with my own doclets, I receive an error that says that javadoc can not find the flag doctitle. It is like that:

C:\myproject>gradle myDoclet
javadoc: error - invalid flag: -doctitle
usage: javadoc [options] [packagenames] [sourcefiles] [@files]
-overview <file>
        Read overview documentation from HTML file
                 Show only public classes and members
              Show protected/public classes and members (default)
                Show package/protected/public classes and members
                Show all classes and members
                   Display command line options and exit
-doclet <class>
         Generate output via alternate doclet
-docletpath <path>
      Specify where to find doclet class files
-sourcepath <pathlist>
  Specify where to find source files
-classpath <pathlist>
   Specify where to find user class files
-exclude <pkglist>
      Specify a list of packages to exclude
-subpackages <subpkglist> Specify subpackages to recursively load
          Compute 1st sentence with BreakIterator
-bootclasspath <pathlist> Override location of class files loaded
                          by the bootstrap class loader
-source <release>
       Provide source compatibility with specified release
-extdirs <dirlist>
      Override location of installed extensions
                Output messages about what Javadoc is doing
-locale <name>
          Locale to be used, e.g. en_US or en_US_WIN
-encoding <name>
        Source file encoding name
                  Do not display status messages
                Pass <flag> directly to the runtime system
  1 error

The point is that “doctitle” is an option from the Standard Doclet, and I am using my own Dolcet that does not include it. So, when gradle puts that “doctitle” option there (I assume it is gradle, because I have not seen anything that sets that option), it creates that error.

Is there any way to “dissable” that automatic “doctitle” from Gradle? Or is there any way to add the standard doclet options to my Doclet?

Thank you very much for your time! :slight_smile:

Which Gradle version?


Sorry, have found the problem, and it was a Javadoc problem, not a Gradle problem. In my doclet, I have not extended the Standard Doclet, so I was not able to access the “doctitle flag”(it is a part of the Standard Doclet).

Sorry for that, and thanks for answering!