Search code examples
javadoclibrariesgradle

Javadoc with Gradle : Don't get the libraries while running javadoc task


I am new to gradle, and I am trying to run javadoc using gradle. I have followed the gradle javadoc page, so I have added my next task in the build.gradle:

 apply plugin: 'java'


task myJavadocs(type: Javadoc) {
source = sourceSets.main.allJava  }

My problem is, that none of the libraries of my project are added, so I get a lot of errors like the next one:

MyClass.java:7: package net.sf.oval.constraint does not exist import net.sf.oval.constraint.NotNull;

What am I doing wrong?

Thanks for your time,

Rafael


Solution

  • You have to configure the class path of your Javadoc task. Something like:

    myJavadocs {
        classpath = configurations.compile
    }
    

    For further configuration options, see the DSL reference.