Download sources through nexus
Answered
When opening a decompiled class file the editor displays options for downloading or choosing sources. When selecting the download option, IntelliJ tries to find the sources at search.maven.org and oss.sonatype.org, but I want it to search our internal nexus repository. How can I add our own repository?
I have tried to add our nexus service url in Settings > Build, Execution, Deployment > Build Tools > Maven, but it does not work as expected.
Please sign in to leave a comment.
You may have this issue: https://youtrack.jetbrains.com/issue/IDEA-110925.
No, it does not seem like the same issue
Is Settings > Build, Execution, Deployment > Build Tools > Maven the correct place to add our nexus url? If so, I tried to remove all other repositories in the list, but it still searches search.maven.org and oss.sonatype.org.
Looks like the repo URLs hardcoded somewhere... For example, I have non-maven project (Ant + Ivy). When I open some compiled class from imported library Idea also proposes to download the sources. And it works fine if the source code of a library is available either in search.maven.org or oss.sonatype.org. But if the library is our own internal library, then obviously the source code won't be found on these repos. I'm also wondering if there is an option to specify our own internal Maven-compatible repos for finding source code using this feature?
For Maven projects repositories are specified in pom.xml. If you are using IvyIDEA plug-in, it may use some other configuration for that.
Hi Serge,
Thank you for your advise. The projects which I'm working at, are not Maven projects. Also, IvyIDEA plugin is not suitable for me. I use my own Ant script for resolving the projects dependencies using Ivy. The connection between my workstation and customer's Nexus repo is too slow, so I didn't include resolving of source files in the script. But sometimes, I need particular source code for some library.
I've taken a brief look at Intellij source code for Community edition (as I understand, the feature for source searching is available for both editions, Community and Ultimate). I found the searcher classes like:
https://github.com/JetBrains/intellij-community/blob/master/java/java-impl/src/com/intellij/jarFinder/MavenCentralSourceSearcher.java
https://github.com/JetBrains/intellij-community/blob/master/java/java-impl/src/com/intellij/jarFinder/SonatypeSourceSearcher.java
Perhaps, it is possible to implement some Source Searcher for custom repos depends on its type, e.g. for Nexus, Artifactory. I'm not sure that all of them provide an API for artifacts searching. But maybe such Idea is planned by JetBrains? :)
Related request: https://youtrack.jetbrains.com/issue/IDEA-143434.
Ok, thank you
https://github.com/JetBrains/intellij-community/commit/0cc1e1fe3ecdf831a3b678badf5f15a084e3cb95
could see this commit