自动下载Gradle项目中的源代码 [英] Automatically download sources in Gradle project

查看:41
本文介绍了自动下载Gradle项目中的源代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Maven项目中,有一个选项可以自动下载所有库的源文件(和javadoc).对于Gradle项目,我没有选择,只能打开一个课程并单击在Internet中搜索".如果您有很多库,这将非常烦人.有什么方法可以自动附加来自Internet的源(Maven回购)?

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

推荐答案

我知道这是一个古老的话题,但是如果有人到达这里并且不希望这个想法,您也可以使用一个插件,然后它将自动解析来源.

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.

例如思想和日食兼容的build.gradle

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

这篇关于自动下载Gradle项目中的源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆