问题描述
理想情况下,我们想添加一个任务来下载我们项目的第一级和传递依赖项的所有源代码罐。有没有办法做到这一点?如果没有,是否有命令行选项提供,如maven必须将所有源下载到我们的机器上?
看起来这应该只是现在的默认值,至少对于第一级的依赖关系来说,因为它给了你eclipse中的javadoc,所以在执行代码完成的时候非常好。
通过在您的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下载所有的源代码罐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!