Skip to content

Fix/nashorn per jvm and libraries zip - #200

Closed
EverNife wants to merge 3 commits into
stagingfrom
fix/nashorn-per-jvm-and-libraries-zip
Closed

Fix/nashorn per jvm and libraries zip#200
EverNife wants to merge 3 commits into
stagingfrom
fix/nashorn-per-jvm-and-libraries-zip

Conversation

@EverNife

Copy link
Copy Markdown
Member

still testing, seems good

packageLibraries computed each artifact's Maven path and then dropped it: the
into() call was commented out and the zipTree beside it fed nothing, so every
jar landed at the archive root.

The jar's own Class-Path, from generateClasspath(), looks each library up at
libraries/<group as path>/<name>/<version>/<name>-<version>.jar. A flat archive
matches none of those, which left this task shipping something unusable for the
one case it exists to cover - an offline server that unpacks it, starts with an
empty classpath, and dies on the first class a library owns.

Each artifact now goes to that exact path, renamed to the Class-Path spelling
because a published file name may carry a classifier and the entry never does.
Verified against the built jar: 73 Class-Path entries, 73 archive members, no
entry on either side without its pair.
The jar's Class-Path named nashorn-core for every JVM, and the JVM reads that
line before any Crucible code runs. On Java 8 the artifact is not merely unused
there: it publishes a javax.script.ScriptEngineFactory, so the first
ScriptEngineManager a mod builds dies with UnsupportedClassVersionError, and the
aborted service scan takes the JDK's own engine down with it - the server never
reaches "Done (".

A library can now be declared deferred in the build. It is still downloaded and
verified like every other one, so a single install serves either JVM, but it is
left out of the Class-Path and listed in a new Crucible-Deferred-Libs manifest
attribute paired with the lowest Java major that can read it. DeferredLibraries,
called from the RFB plugin, attaches the ones this JVM qualifies for to both RFB
class loaders: the launch loader answers the ServiceLoader resource scan, the
compat loader answers the class loads a LaunchClassLoader exclusion delegates
upwards.

Measured on a CustomNPC-Plus modpack, same jar and same libraries/ on both runs:
Java 8 boots first try reporting the built-in engine, Java 21 boots first try
reporting the standalone one, neither asking for a restart.
packageLibraries was never wired into buildPackages, and buildPackages is all
CI runs. The release step attaches everything in build/distributions, so the
offline archive was absent from every pre-release - it existed only for whoever
knew to invoke the task by name.

It is a dependency of buildPackages now, ordered after cleanPackages, which
empties build/distributions: nothing related the two before, and an unordered
pair can just as easily write the archive and then delete it.
@EverNife EverNife closed this Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant