Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to download javadocs and sources for jar using Gradle 2.0?

I am using Gradle 2.0. What should I write in build.gradle so that the javadocs and sources are also downloaded along with the jars?

like image 904
khateeb Avatar asked Feb 09 '15 06:02

khateeb


People also ask

How can you generate JavaDoc in Gradle?

To do this in Gradle, we must add the option to the javadoc task configuration. We use the addBooleanOption method of the options property that is part of the javadoc task. We set the argument to html5 and the value to true .

How do I download Maven source code?

To download sources for dependencies of maven project, right click on project → Maven → Download Sources . Similarly to download JavaDoc for dependencies of maven project, right click on project → Maven → Download JavaDoc .

Can Gradle download JDK?

Gradle will only download JDK versions for GA releases. There is no support for downloading early access versions.


2 Answers

I guess your question is related to a dev workspace, here are links explaining how to add the required configuration in Gradle using the IDEs' plugins:

For Eclipse:

apply plugin: 'java' apply plugin: 'eclipse'  eclipse {     classpath {         downloadJavadoc = true         downloadSources = true     } } 

For IntelliJ & Android Studio

apply plugin: 'java' apply plugin: 'idea'  idea {     module {         downloadJavadoc = true         downloadSources = true     } } 

To run these plugins:

gradle cleanEclipse eclipse gradle cleanIdea idea 
like image 111
Paul Podgorsek Avatar answered Sep 23 '22 10:09

Paul Podgorsek


In addition to previous question, here is Gradle Kotlin DSL version:

plugins {     id("idea") }  idea {     module {         isDownloadJavadoc = true         isDownloadSources = true     } } 
like image 35
Alexander Davliatov Avatar answered Sep 23 '22 10:09

Alexander Davliatov