Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 1000
raspayu Avatar asked Jun 05 '12 09:06

raspayu


People also ask

What is Java Library plugin Gradle?

The Java Library plugin expands the capabilities of the Java plugin by providing specific knowledge about Java libraries. In particular, a Java library exposes an API to consumers (i.e., other projects using the Java or the Java Library plugin).

What is runtimeOnly in gradle?

Note: You can't use the compileOnly configuration with AAR dependencies. runtimeOnly. Gradle adds the dependency to the build output only, for use during runtime. That is, it is not added to the compile classpath. This configuration behaves just like apk (which is now deprecated).


1 Answers

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.

like image 77
Peter Niederwieser Avatar answered Nov 09 '22 02:11

Peter Niederwieser