简体   繁体   English

如何自动附加源代码以在Intellij中进行依赖?

[英]How to automatically attach source code for dependency in Intellij?

I have a project (built with Maven) which has many internal dependencies; 我有一个项目(使用Maven构建),该项目具有许多内部依赖性。 some of these dependencies are built with Maven and sources can be deployed along with the binaries (and Javadoc) in the central repository; 其中一些依赖关系是使用Maven构建的,并且可以将源代码与二进制文件(和Javadoc)一起部署在中央存储库中; say these are dependencies A. But some dependencies do not have sources (as jar in repository) and cannot be set to be deployed with sources when built (huge Ant script and no one wants to break it); 说这些是依赖项A。但是有些依赖项没有源(如存储库中的jar),并且不能在构建时设置为与源一起部署(巨大的Ant脚本,没有人想破坏它); say these are dependencies B. 说这些是依赖性B。

When debugging with Intellij, I reach classes from these dependencies and I want to see their source code. 使用Intellij进行调试时,我从这些依赖项访问了类,并且希望查看其源代码。 IDEA lets me choose to download the sources form artifacts repository (this only works for dependencies A) or to attach them from a local folder. IDEA让我选择下载源表单工件存储库(这仅适用于依赖项A)或从本地文件夹附加它们。 I have the folder with the sources for dependencies B and I always set that folder. 我有包含依赖项B来源的文件夹,并且我总是设置该文件夹。

Can Intellij be set to automatically download all the sources (for dependencies that have sources in repository) or, if not, to attach them from configurable local folder(s) for all the dependencies, when a project is loaded? 加载项目时,可以将Intellij设置为自动下载所有源(对于在资源库中具有源的依赖项),或者如果不是,则从所有可依赖项的可配置本地文件夹中附加它们? Or is there a plug-in for this? 还是为此有一个插件?

I'm afraid it's not possible to do such configuration automatically. 恐怕不可能自动进行这种配置。 Consider keeping all the sources in the Maven repository, in this case you can configure IDEA to download them automatically. 考虑将所有源代码保存在Maven存储库中,在这种情况下,您可以配置IDEA以自动下载它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM