How to automatically attach source code for depend

2019-04-15 22:50发布

问题:

I have a project (built with Maven) which has many internal dependencies; some of these dependencies are built with Maven and sources can be deployed along with the binaries (and Javadoc) in the central repository; 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); say these are dependencies B.

When debugging with Intellij, I reach classes from these dependencies and I want to see their source code. 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. I have the folder with the sources for dependencies B and I always set that folder.

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? Or is there a plug-in for this?

回答1:

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.