github jbangdev/jbang v0.144.0

one hour ago

This is a mixed bag of fixes but some key improvements - driven by the wonders and horrors of AI and the cost of public infrastructure.

CLI docs and Skills

Lets start with the wonders of AI - LLM's work really well with CLI's; especially if the help/usage command is informative - thus all commands in jbang cli now has more complete and clean documentation including examples of what each command can do. If that is not enough for your favourite coding agent to grok the wonders of Java and how JBang makes it easier to use - this release also bring jbang skill subcommand that will install and enable various jbang skills from https://github.com/jbangdev/agent-skills.

Just run jbang skill install and it will setup agents.md. Running install later will get updates of the skills.

Maven Central limits and mirroring

In October Sonatype enforced more rate limits which started hitting our Github Action CI jobs hard. We probably weren't good central citizens so that was fair but in trying to enable use of mirrors and cache more locally we found JBang's mirror support had some glitches - especially when it came to authentication and error messages.

JBang already honored default Maven settings.xml files mirror settings:

<mirror>
<id>company</id>
<mirrorOf>*</mirrorOf>
<url>https://nexus.mycompany.com/repository/maven-public/</url>
</mirror>

But sometimes you don't want to touch Maven's settings or can't actually get to set one up ? Thus JBang can now be configured explicitly to have its own mirror setup beyond Maven's. Of course in usual JBang fashion also with much less ceromony.

I.e. if you want JBang to use google central mirror just do:

jbang config set repos-mirror central=google-central 

or if you want to use an internal/private maven artifact proxy then do:

jbang config set repos-mirror https://nexus.mycompany.com/repository/maven-public/

The syntax for how to define is same as Maven mirrorOf syntax; just simplified. See docs for details.

central is now repo.maven.apache.org

Until now JBang used repo1.apache.org - which works perfectly fine BUT because Maven and Gradle uses repo.maven.apache.org some unecessary double downloading occurs but mirroring gets tricky to get right.

This can/will trigger some more downloads and --offline might not work - simply reconnect and let JBang fetch metadata/packages from the real hostname and things should work again.

~/.jbang-netrc

In recent release we added support for .netrc files to have better auth for private repos - unfortunately some tools like mise didn't like the extra key/value we added thus now we also reads ~/.jbang-netrc and merges it with ~/.netrc per host. Handy when another tool that reads ~/.netrc chokes on JBang-specific keys like jbang-auth gh-auth - keep those in ~/.jbang-netrc and leave the login/password where they are.

Several //JAVA lines now combine properly

When a script and the files it pulls in with //SOURCES ask for different Java versions, JBang now picks one that satisfies all of them:

//JAVA lines JBang uses
17+ and 21+ 21+
17+ and 21 21
17 and 21 17 - with a warning

Before, a bug meant JBang could pick a version that was too old for one of the files and you would not be aware.

//JAVA 17 (no +) means exactly 17, as it always has. If that conflicts with another //JAVA, the main script wins and you get a warning - if newer versions are fine, just add a +. See Java versions.

jbang version --update honors native builds

When doing jbang updates and you use jbang in native mode (JBANG_USE_NATIVE=true) we now also update the native jbang binary keeping things in sync! Give it a try. If all goes well we might flip to native be the default :)

Fixes worth calling out

  • Security: upgraded jsoup and the HTTP client stack for CVE-2026-40542, CVE-2026-64607, CVE-2026-54399 and CVE-2026-54428. (JBang was and is not affected but just to stop the CVE warnings)
  • No more final field mutation warnings from Gson on Java 26+.
  • Truncated downloads are now reported - and not cached - on JDK 24+, instead of failing with "Premature EOF".
  • //SOURCES that point back at a file through .. no longer recurse forever.
  • The native binary no longer crashes with some locales, e.g. "English (World)" on Windows.
  • A broken local catalog gives one readable warning instead of an exception, and JSON errors in catalogs are reported properly.
  • jbang init no longer deletes existing files or leaves half-written output behind when it fails.
  • .netrc gh-auth/glab-auth no longer mistake a tool's warning on stderr for the token.
  • Dependency resolution uses Maven's path conflict resolver, so JBang picks the same versions Maven does.
  • jbang version --update honours JBANG_USE_NATIVE and installs the native build.
  • jbang build --native works from an existing jar, and fat jars keep service providers from all dependencies.

Thanks

A big thanks to everyone who contributed to this release: @arnabnandy7, @imeerkhurram, @gelatoni-xh, @mukel, @bartoszpop, @arimu1, @Bhumika-SN, @instreest, @sagarrsharmaa, @toyeshhm, @UgurcanGursen and @wfouche - and to @quintesse for the reviews and second opinions.

Have fun!

Changelog

๐Ÿ”€ Merge

  • 05ceb81 Merge pull request #2737 from maxandersen/fix/init-failure-cleanup
  • a614fce Merge branch 'main' into fix/init-failure-cleanup

๐Ÿš€ Features

  • f6c6707 feat: read ~/.jbang-netrc and merge it with ~/.netrc (#2770)
  • 9e26585 feat: better Maven mirror support (#2773)
  • 20f026c feat: prefer relative symbolic links (#2620)
  • 84456c0 feat: use the path conflict resolver for dependency resolution (#2741)
  • e5af0ea feat: add 'jbang skill' command to install agent skills (#2625) (#2692)
  • 8354643 feat: clearer, grouped help output with prose and examples (#2702)
  • 76d802d feat: let aesh built-in --aesh-* commands work with their arguments

๐Ÿ› Fixes

  • 674979a fix: don't read auth helpers' stderr as the token (#2787)
  • de6629b fix: combine multiple //JAVA versions as constraints, warn on conflicts (#2528)
  • eba6208 fix(deps): update dependency jacoco to v0.8.16 (#2764)
  • 5afbef4 fix: warn once about a broken local catalog, without exception class names (#2782)
  • ca75824 fix: stop //SOURCES that point back to a file through .. from recursing forever (#2768)
  • cc60ef4 fix: load Windows PowerShell's own Security module for the execution policy check (#2767)
  • 67e2c46 fix: report JSON errors in a catalog instead of "Unable to download catalog ... via null" (#2769)
  • 6cc4948 fix: keep trust suggestions and "Trust once" to what was asked for (#2779)
  • fc196f3 fix: use repo.maven.apache.org for Maven Central (#2778)
  • e986ba6 fix: support runtime locales in native image (#2615)
  • 2b9b76c fix: honor //JAVA version in edit --sandbox gradle (#2634)
  • ac27303 fix: resolve editor command to executable filename for Git Bash on Windows (#2460)
  • c5ee076 fix: translate RELEASE/LATEST to Gradle's latest.* in generated build.gradle (#2750)
  • 2899091 fix: only clean up files init created itself, handle dangling symlinks
  • b65f05e fix(deps): update eu.maveniverse.maven.mima dependencies to v3.0.2 (#2733)
  • d5ae414 fix: honor JBANG_USE_NATIVE when updating (#2616)
  • cc3ad41 fix: use ${ROOT-COMMAND-NAME} instead of hardcoded jbang in help (#2738)
  • bb542d1 fix: list cleaned-up init files once, one path per line
  • a4bcb86 fix: init no longer deletes existing files or leaves partial output on failure
  • 1e1e86d fix: report an error when init cannot write the script (#2726)
  • e3d4c8d fix: report truncated downloads consistently on JDK 24+ (#2732)
  • d8cb7ea fix: don't cache downloads that end before their Content-Length (#2729)
  • 84e70cb fix: set wrapper file timestamps to the current time instead of 1980 (#2658)
  • 52d3ff3 fix: avoid final field mutation when Gson reads catalogs and integration data (#2723)
  • 107ac04 fix: upgrade vulnerable jsoup and HTTP dependencies (#2718)
  • 3d1f731 fix: jbang build --native from existing/pre-built jar (#2623)
  • 660949d fix: separate merged fatjar service providers (#2709)
  • f6d0a8a fix(build): use spotless to fornat gradle files (#2708)
  • 49f0d26 fix: only force colors in the bash launcher when stdout is a terminal (#2703)
  • cce144b fix: make app setup --java/--no-java usable as flags (#2701)
  • 2d67c06 fix: honour attached value for -d and reject invalid ones (#2700)
  • 8868142 fix: align genadoc.java aesh version and add --format option (#2699)
  • 6c28a16 fix: avoid duplicated valid values in --source-type help (#2694)
  • 2a297f3 fix: update agents.md to be correct about picocli/aesh

๐Ÿ”„๏ธ Changes

  • 3c47d3c refactor: centralize required-argument validation via validateArguments() hook (#2695)

๐Ÿงช Tests

  • 351ee16 test: drop the log4j seed from test_suite.sh (#2785)
  • a328d95 test: keep test_suite.sh's custom JBANG_REPO from hitting Maven Central (#2754)
  • a0e0b5e test: isolate launcher color tests from inherited JVM options (#2711)
  • ad53e60 test: validate before doCall in checkedRun harness (#2696)

๐Ÿงฐ Tasks

  • a1b83b4 chore(deps): update plugin com.gradleup.shadow to v8.3.11 (#2759)
  • b70c6d8 chore(deps): update gradle to v8.14.8 (#2758)
  • 460ab53 chore(deps): update jbangdev/jbang-action docker digest to ef11ba6 (#2746)
  • 37d3b0c chore(deps): update github/codeql-action action to v4.39.5 (#2757)
  • c4ab282 chore(deps): update actions/upload-artifact action to v7.0.2 (#2751)
  • c94c535 chore(deps): update dependency dotnet-sdk to v2.2.402 (#2753)
  • e8ed519 chore(deps): update gradle/actions digest to 8da46b5 (#2745)
  • bb1c1a3 chore(deps): update actions/github-script digest to f28e40c (#2721)
  • 0853b1b chore(deps): update actions/download-artifact digest to 9000827 (#2689)
  • 0b8ce75 chore(deps): update actions/checkout digest to fbc6f39 (#2688)

๐Ÿ›  Build

  • 051de36 build: declare gson 2.15.0 (#2784)
  • 28e7263 build: set JBang-Version in the jar manifests at configuration time (#2774)
  • 6f5d7cf ci: resolve Maven Central through Google's mirror in CI (#2771)
  • a5f5578 build: update AspectJ weaver to 1.9.27 for JDK 27 test runs (#2740)
  • c7f4df7 build: rerun integration tests when launcher scripts or itests change (#2763)
  • 61173d8 build: keep CodeRabbit reviews short (#2756)
  • c695c0f ci: run macOS integration tests on Java 25 only (#2755)
  • 2e4f102 ci: cache the maven repo used by unit tests (#2752)
  • 41cd52f ci: use version tags in composite actions, actions.lock pins the commits (#2747)
  • 3a517af ci: lock workflow action dependencies with actions.lock (#2744)
  • 19e8b4a ci: one test maven repo cache per job type, cache ~/.m2 for smoke tests (#2743)
  • d599d28 ci: cache the Maven repo used by integration and smoke tests (#2739)
  • 2f4c610 build: remove unused asciidoctor plugin and Roq website teaser (#2734)
  • b6c4ce7 build: run tests on latest GA and EA JDK (#2715)
  • 6ce2f93 ci: use a GitHub App token for jbang-pr-builds (#2725)
  • d816041 build: update aesh to 3.18.1 and readline-api to 3.18.1 (#2693)

๐Ÿ“ Documentation

  • da3cbf8 docs: add missing contributors (#2760)
  • fa5ca3d docs: explain how to identify JBang applications in VisualVM (#2697)
  • 23dcc4c docs: fix out-of-sequence section level in integration page (#2731)

Don't miss a new jbang release

NewReleases is sending notifications on new releases.