Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically download sources in Gradle project

In Maven projects, there is an option to automatically download sources (and javadoc) for all libraries. For Gradle project I found no option, just to open a class and click "Search in internet". This is very annoying if you have a lot of libraries. Is there any way to automatically attach sources from the internet (maven repo)?

like image 934
WonderCsabo Avatar asked Jun 30 '14 09:06

WonderCsabo


1 Answers

I know that this is an old topic, but in case someone reaches here and does not want to gradle idea, you can also use a plugin and then it will resolve sources automatically.

e.g. both idea and eclipse compatible build.gradle

plugins {
  id "java"
  id "idea"
  id "eclipse"
}

idea {
  module {
    downloadSources = true
  }
}

eclipse {
  classpath {
    downloadSources = true
  }
}

dependencies {
  compile group: 'commons-io', name: 'commons-io', version: '2.6'
}
like image 75
Haim Adrian Avatar answered Sep 28 '22 08:09

Haim Adrian