Locate sources JAR if it is next to binary JAR #5156
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A year ago I was working on a project that integrates JavaScript, JVM & etc. into Oracle DB. Most of the colleagues were using Eclipse or IntelliJ, but I was very happy with NetBeans VSCode extension (btw. I needed needed VSCode remote development as the machine with all the sources was over ssh across the Atlantic ocean).
Things were working OK, but over the pair programming with colleagues I realized that NetBeans lacks better integration with sources. When their IDEs could jump to a source code, my just disassembled the
.class
file!After a while I realized that the project is carefully structured and next to each JAR there is also
-sources.jar
and the other IDEs are able to pick it up. Just NetBeans was missing such functionality. This PR is my attempt to add it. I am putting this functionality next to classpath support - e.g. not associated with any project as it is a general behavior not related to Maven or Gradle or etc. I am associating lateposition
with the@ServiceRegistration
so other registered mechanisms take precedence and this is used just as a fallback.Btw. Right now I am working with a project that uses Scala build tool to assemble Scala and Java sources. It also uses the same convention! There is
$HOME/.cache/coursier/v1/https/repo1.maven.org/maven2/org/openjdk/jmh/jmh-core/1.35/jmh-core-1.35.jar
and next to it$HOME/.cache/coursier/v1/https/repo1.maven.org/maven2/org/openjdk/jmh/jmh-core/1.35/jmh-core-1.35-sources.jar
- looks like this is a well known convention that is beneficial to support!