Include local javadoc with gradle

(Kasper Sørensen) #1

Hi there,
I am trying to figure out a way to show javadoc from a local .jar in my project, so I can see the documentation in intelliJ (and possible also NetBeans).

My build.gradle contains the following to include the local jars:

dependencies {
    compile fileTree(dir: "./src/libs/", includes: ['*.jar'])

and in the libs folder is three .jar files (compiled java, sources and javadoc) all for the same project.

What I cannot figure out it how get intelliJ to read the javadoc and show that. I made a small task with

task listJars {
    configurations.compile.each { File file -> println }

to confirm that all the .jar files are included, which they are. The task outputs:


The -javadoc.jar was created in another project with the javadoc task.

I also have

apply plugin: 'idea'
idea {
    module {
        downloadJavadoc = true

which is not really helping me in this case

Hope you guys can help!

Put jar file to cache manually
(uklance) #2

The simplest way to achieve this is layout the jars in a maven style directory layout.



You can then reference the dependency in your build

repositories {
   maven {
      url file('mavenRepo') 
dependencies {
   compile 'group:PickRandomStudent:1.0'

This has the added benefit that the jars can now properly participate in Gradle’s dependency resolution process

(Kasper Sørensen) #3

Ah yes! Thank you very much @Lance !