Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle Javadoc task without warnings

I generate a javadoc .jar file with Gradle for my Android project. I'm using a similar setup like in this instruction.

But I'm getting a lot of warnings that many symbols are missing. I noticed that the javadoc task doesn't find any of my dependencies. How can I add my dependencies to javadoc task's classpath?

Here is my upload task:

afterEvaluate { project ->
    uploadArchives {

    //...

    }

    //...

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

    task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
        classifier = 'javadoc'
        from androidJavadocs.destinationDir
    }

    //...

    artifacts {
        archives androidSourcesJar
        archives androidJavadocsJar
    }
}

There is also filed bug, but I'd like to have a solution now.

like image 984
vRallev Avatar asked Feb 03 '14 10:02

vRallev


1 Answers

roman-mazur answered the question in another issue at Github.

There is currently a discussion going on, whether it's the right way. But for the moment adding these lines solved my issue:

afterEvaluate {
    javadocs.classpath += files(android.plugin.runtimeJarList)
}
like image 200
vRallev Avatar answered Sep 28 '22 22:09

vRallev