JavaDoc: how reference the src/main/java classes from src/test/java


(Manuel Jordan) #1

Hello Developers

I am working with Spring Framework in a multi-module project

About JavaDoc I have the following:

task masterMainJavadoc(type: Javadoc, group: "Documentation") {
    description = 'Generates a master javadoc from all the modules (main)'
    source exportedProjects.collect { project(it).sourceSets.main.allJava }    											  
    classpath = files(exportedProjects.collect { project(it).sourceSets.main.compileClasspath })
    options.memberLevel = JavadocMemberLevel.PRIVATE
    options.addStringOption("charset", "UTF-8")
    options.links 'http://docs.oracle.com/javase/8/docs/api/'
    options.links 'http://docs.oracle.com/javaee/7/api'
    ...
    destinationDir = file("${buildDir}/docs/javadoc/main")
}

I have practically the same for Testing

task masterTestJavadoc(type: Javadoc, group: "Documentation") {
    description = 'Generates a master javadoc from all the modules (test)'
    source exportedProjects.collect { project(it).sourceSets.test.allJava }    											  
    classpath = files(exportedProjects.collect { project(it).sourceSets.test.compileClasspath})    				  
    options.memberLevel = JavadocMemberLevel.PRIVATE
    options.addStringOption("charset", "UTF-8")
    options.links 'http://docs.oracle.com/javase/8/docs/api/'
    options.links 'http://docs.oracle.com/javaee/7/api'
    ...
    destinationDir = file("${buildDir}/docs/javadoc/test")
}

Until here, I need work and generate two JavaDocs, one for main classes (all from src/main/java) and other for testing classes (all from src/test/java). With all the code shown above, it is possible.

The JavaDoc generated for testing works as expected but is generated in the following way, for example:

public static com.manuel.jordan.domain.Persona crearPersona02()

I need

public static Persona crearPersona02()

Persona is a class located in src/main/java and from the Javadoc I need do a click there and arrive to the Persona class

So what extra configuration I need to do to accomplish this requirement?

Thanks in advance.