Automatically download sources in Gradle project

我只是一个虾纸丫 提交于 2021-01-27 05:50:31

问题


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)?


回答1:


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'
}


来源:https://stackoverflow.com/questions/24486883/automatically-download-sources-in-gradle-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!