Permit entire folder of JARs to be included as one classpath entry - #9545
Open
michaelsembwever wants to merge 2 commits into
Open
Permit entire folder of JARs to be included as one classpath entry #9545michaelsembwever wants to merge 2 commits into
michaelsembwever wants to merge 2 commits into
Conversation
michaelsembwever
force-pushed
the
mck/6044
branch
from
August 7, 2026 11:14
3bed27e to
2b152ce
Compare
Member
|
added a few labels and restarted CI |
michaelsembwever
commented
Aug 7, 2026
michaelsembwever
commented
Aug 7, 2026
A <classpath> path token whose last component is a filename glob (containing '*' or '?') is now expanded to the archives in the directory it names; e.g. "build/lib/*" or "build/lib/*.jar" reference every JAR in "build/lib". This mirrors the wildcard classpath syntax of the java launcher and lets a freeform project point at a folder of libraries instead of listing each JAR by its versioned filename. Tokens without a glob keep their previous meaning. The directory backing each wildcard is watched, so JARs produced by a later build are picked up automatically without editing project.xml. Change notifications are coalesced and dispatched off the file-event thread to avoid inverting lock order with listener registration. The wildcard syntax is documented in freeform-project-java-5.xsd and covered by new ClasspathsTest cases. Closes apache#6044
michaelsembwever
force-pushed
the
mck/6044
branch
from
August 7, 2026 14:12
2b152ce to
71419c3
Compare
Member
Author
|
@mbien , are the CI failures real ? looking like just timeouts ? |
Member
|
those are known to fail from time to time. Esp during full moon or the release phase. |
mbien
reviewed
Aug 7, 2026
|
|
||
| private static final ErrorManager err = ErrorManager.getDefault().getInstance(Classpaths.class.getName()); | ||
|
|
||
| /** Recomputes wildcard classpaths off the file-event thread; see {@code wildcardListener}. */ |
Member
There was a problem hiding this comment.
you can use /// comments for javadoc one-liners if you want. The formatter would break the line otherwise. Modules can be bumped to JDK 21 level.
| } | ||
|
|
||
| /** JARs produced after the project is opened are picked up without editing project.xml. */ | ||
| @RandomlyFails // depends on asynchronous filesystem-event delivery + coalescing |
Member
There was a problem hiding this comment.
how bad is it? @RandomlyFails is discouraged for new tests since CI won't run it - and if it doesn't run it will age.
Comment on lines
+510
to
+518
| switch (c) { | ||
| case '*': sb.append(".*"); break; // NOI18N | ||
| case '?': sb.append('.'); break; | ||
| default: | ||
| if ("\\.[]{}()+-^$|".indexOf(c) >= 0) { // NOI18N | ||
| sb.append('\\'); | ||
| } | ||
| sb.append(c); | ||
| } |
Member
There was a problem hiding this comment.
if you want you could set javac.release=21 and use the arrow syntax.
Comment on lines
+492
to
+495
| final URL entry = FileUtil.urlForArchiveOrDir(kid); | ||
| // Only archives yield a URL ending in '/'; skip anything that is not | ||
| // a valid classpath root (matches the java launcher's JARs-only rule). | ||
| if (entry != null && entry.toExternalForm().endsWith("/")) { // NOI18N |
Member
There was a problem hiding this comment.
FileUtil.isArchiveFile(url) doesn't work here?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Permit entire folder of JARs to be included as one classpath entry
Fixes #6044
( Originally https://bz.apache.org/netbeans/show_bug.cgi?id=116185 )
Component: freeform
Minor enhancement to the freeform project (for external ant scripts).
The classpath requires full name for .jar files (since .jar files are folders themselves).
This is easily painful in many projects: as many software releases these days are putting version numbers as part of the .jar file names (e.g. javolution-5.2.3.jar). Any updates to these softwares gets .jar files renamed requiring update to project.xml.
I would like to suggest accepting folders containing .jar files in classpath and expanding it for use automatically on netbeans.
Use case/motivation
See https://github.com/apache/cassandra/blob/trunk/ide/nbproject/update-netbeans-classpaths.sh
This script only exists because of the lack of this improvement.
Click to collapse/expand PR instructions
If you're a first time contributor, see the Contributing guidelines for more information.
PR approval and merge checklist:
If this PR targets the delivery branch: don't merge. (full wiki article)