如何分辨gradle下载所有的源代码罐 [英] how to tell gradle to download all the source jars

查看:179
本文介绍了如何分辨gradle下载所有的源代码罐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

理想情况下,我们想添加一个任务来下载我们项目的第一级和传递依赖项的所有源代码罐。有没有办法做到这一点?



如果没有,是否有命令行选项提供,如maven必须将所有源下载到我们的机器上?



看起来这应该只是现在的默认值,至少对于第一级的依赖关系来说,因为它给了你eclipse中的javadoc,所以在执行代码完成的时候非常好。


<如果您使用Eclipse并希望浏览您的依赖关系的源代码,那么Eclipse插件会为您执行此操作。



通过在您的build.gradle文件中添加 apply plugin:eclipse来安装eclipse插件。然后运行 gradle eclipse 来生成Eclipse .project,.classpath和.settings文件。该插件将自动下载所有可用的源代码,并将它们添加到.classpath文件中(请参阅 classpathentry sourcepath 属性>元素)。



要将项目导入Eclipse,请选择 File>导入...>将现有项目放入工作区并选择您的项目。



(我不确定Idea插件是否对Idea用户有同样的作用,但它可能会)。


Ideally, we would like to add a task for downloading all the source jars for the first level and transitive dependencies of our project. Is there a way to do that?

If not, is there a command line option to supply like maven has to get all the sources downloaded onto our machines?

It seems like that should just be the default these days at least for first level dependencies as it gives you the javadoc in eclipse then which is very nice when doing the code completion stuff.

解决方案

If you use Eclipse and want to navigate the source code of your dependencies there, then the Eclipse plugin does this for you.

Install the eclipse plugin by adding apply plugin: "eclipse" to your build.gradle file. Then run gradle eclipse to generate the Eclipse .project, .classpath and .settings files. The plugin will download all available sources automatically and add references them in the .classpath file (see the sourcepath attribute of the classpathentry element).

To import the project into Eclipse, choose File > Import... > Existing Projects into Workspace and select your project.

(I'm not sure whether the Idea plugin does the same for Idea users, but it may do).

这篇关于如何分辨gradle下载所有的源代码罐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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