Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Locate sources JAR if it is next to binary JAR #5156

Merged
merged 1 commit into from
Dec 29, 2022

Conversation

jtulach
Copy link
Contributor

@jtulach jtulach commented Dec 27, 2022

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 late position 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!

@jtulach jtulach self-assigned this Dec 27, 2022
Copy link
Contributor

@lkishalmi lkishalmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!
I really hope that SBT improved to be a good build tool over the last 8 years. At that time it was horrible...

@jtulach
Copy link
Contributor Author

jtulach commented Dec 29, 2022

sbt is still horrible ;-) But not that horrible to warrant rewrite.

@jtulach jtulach merged commit 9a86d27 into apache:master Dec 29, 2022
@mbien mbien added the Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) label Dec 30, 2022
@neilcsmith-net neilcsmith-net added this to the NB17 milestone Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants