Maven dependencies in workspace - but still download sources needed


I have project with multiple modules, basically two types

  • A - applications, dynamic-snapshots
  • B - libraries/interfaces, dynamic-snapshot, without sources in maven repo
  • applications depend on libraries -> but on versioned ones

Whenever I need to go to libraries code while looking at libraries Intellij is showing decompiled code with option to "Download sources", "Choose sources"
If version of library changes (and it changes on daily basis) I need to choose sources once again.

Is there any possibility to configure this permanently? That some artifact form my workspace is source code for some maven library?


Comment actions Permalink

Hi Lucasz,

Instead ofclicking on "Download Sources" or "Attach Sources..." navigate to the library in "Project Structure / Libraries" then go to "Sources" and press "Add". From there, you can choose arbotrary folder with sources for that library - in your case, the src folder of the library project.
This works for me.

Hope that helps

Comment actions Permalink

Hi Ivaylo,

Thank you for pointing this option, but if I understand this correctly - this would work as long as I have library in specific version?
In my case platform libraries are published few times a day:
and so on, but in my source it's still defined as dynamic-snapshot

So I would still need to add sources for my library in version 1.0, 1.1....?


Comment actions Permalink

Oh, I see.
To overcome similar issue in my setup, I imported the library sources as a project module, so that I always have most recent version of the sources indexed by the IDE, and didn't download or attached maven library dependency any sources.
Don't know if this will work for your case though.


Please sign in to leave a comment.