Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to download dependency sources for Gradle project in IDEA?

It appears that the eclipse plugin uses the following mechanism to do this:

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

but I can't find a corresponding option for the idea plugin. What am I missing?

Here's the build.gradle file:

apply plugin: 'groovy' apply plugin: 'idea'  repositories {     mavenCentral()     mavenRepo name: "Grails", url: "http://repo.grails.org/grails/repo/" }  dependencies {     groovy 'org.codehaus.groovy:groovy-all:2.0.4'     compile 'org.slf4j:slf4j-log4j12:1.6.6', 'postgresql:postgresql:9.1-901.jdbc4', 'net.sourceforge.nekohtml:nekohtml:1.9.16'     ['core', 'hibernate', 'plugin-datasource', 'plugin-domain-class'].each { plugin ->         compile "org.grails:grails-$plugin:2.1.0"     } }  idea {     module {         downloadJavadoc = true         downloadSources = true     } }  // Fat Jar Option (http://docs.codehaus.org/display/GRADLE/Cookbook#Cookbook-Creatingafatjar) jar {     from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } }  task wrapper(type: Wrapper) {     gradleVersion = '1.0' } 
like image 548
WXB13 Avatar asked Oct 04 '12 00:10

WXB13


People also ask

How install dependencies build Gradle?

Simply open the gradle tab (can be located on the right) and right-click on the parent in the list (should be called "Android"), then select "Refresh dependencies". This should resolve your issue.

Where do Gradle download dependencies?

Gradle declares dependencies on JAR files inside your project's module_name /libs/ directory (because Gradle reads paths relative to the build.gradle file). This declares a dependency on version 12.3 of the "app-magic" library, inside the "com.example.android" namespace group.


1 Answers

I've got problems with the following configuration:

 idea {     module {         // if you hate browsing Javadoc         downloadJavadoc = false          // and love reading sources :)         downloadSources = true     } }  repositories {     mavenLocal()     mavenCentral() } 

When removed mavenLocal() sources were downloaded and attached.

like image 180
naXa Avatar answered Sep 18 '22 13:09

naXa