Releases: jbangdev/jbang
v0.93.0
Changelog
Mainly small fixes.
JBang no longer uses @file for large classpath/command lines with JShell. This should allow it run for more things; but can also give problems with large dependency sets on Windows. Recommend to use powershell or a linux-like terminal on Windows to avoid problems.
Export now is possible for projects without a main, i.e. for building libraries.
Also //FILES
will now tell you what file pattern failed to be resolved. Making it easier to debug.
🚀 Features
🐛 Fixes
- 59b5483 do not use @file with jshell. Fixes #1349 (#1352)
- 018acde add sources to export (#1348)
- 5c8094c ignore dependencies without GVA for integration (#1350)
- 0397de4 Fixed problem with merging old PR #1271
- c62087c some errors in alias documentation page (#1329)
- 3f01dc8 Run locally with 'act' fails (jbangdev/jbang-action#28) (#1328)
🧰 Tasks
- e7391c1 add explicit cast
- 0750e62 switch code coverage to informational only
- 7d6b632 fix typo in StrictParameterPreprocessor.java (#1333)
🛠 Build
📝 Documentation
Contributors
We'd like to thank the following people for their contributions:
Andrea Peruffo, Tako Schotanus, George Gastaldi, Ikko Ashimine, Jeremie Bresson, Max Rydahl Andersen, GitHub, Pierre-Yves Fourmond, allcontributors[bot]
v0.92.2
Changelog
Fixed a bug that caused (Quarkus) external Integration to fail on Java 16+.
🐛 Fixes
🛠 Build
- 3bb37cc force ext integration
- 07b49e6 run only itests when feasible
- 4936280 fail-fast off
- 0a7b798 proper external ci test
- 7c48421 dont enable gradle cache when not building with cache
- 421a978 add java 17 and 18 runs
- eb98460 add java 17 and 18 runs
- bc68aca [patch] release
- 662a75a Revert "Revert "fall back to TTY when asking for input on Linux/Mac (#1312)""
- 211f020 Update copyright year to 2022 (#1315)
Contributors
We'd like to thank the following people for their contributions:
Claus Ibsen, Max Rydahl Andersen, GitHub
v0.92.1
Changelog
Had to revert zero install changes to avoid app install
bug.
- 048a68b [patch] release
- ef580a7 Revert ""zero" install now lives up to its name (#1219)"
- 9397a94 Revert "fall back to TTY when asking for input on Linux/Mac (#1312)"
Contributors
We'd like to thank the following people for their contributions:
Max Rydahl Andersen
v0.92.0
Changelog
This time with a mixed bag of features/improvements:
Console trust and "zero" install
Running using curl
will now download jbang to a temporary location if no local .jbang jar found. This ensures if you run curl
install it will use the latest available.
Also When installing or running jbang using curl
osx and linux will now use /dev/tty
to
allow using console to approve/trust scripts. Windows will still use the UI based approach if necessary.
We also now don't ask to trust a script you already downloaded and not running with --fresh
.
This should all make the installation of jbang and running of scripts simpler and more reliable.
Integrations can run externally
Today when using jbang integrations (i.q. Quarkus integration) it runs in the same jvm/classloader
as jbang itself. This works normally great, but if you are targeting a Java higher than the Java you are running JBang with (i.e. uses --java 17
when running with Java 11) you can get errors about mismatched Java versions.
In this release JBang now will run the integration in an external process when Java versions does not match.
This also enables a future possible improvement of making jbang
a native binary.
Allow aliases for //SOURCES
You can now use aliases in //SOURCES
. This is mainly interesting when running jshell based scripts. For example in a .jsh file you can use //SOURCES faker@jbangdev
and you get the faker script included.
Enjoy!
🚀 Features
- ea20eff "zero" install now lives up to its name (#1219)
- d942ada fall back to TTY when asking for input on Linux/Mac (#1312)
- b44d783 enable integrations to run externally (#1290)
- d3e726c allow aliases for
//SOURCES
(#1287) - c032ce2 don't ask for trust when resource is cached (#1291)
🐛 Fixes
- e379591 fixed problem
--deps
and//REPOS
(#1296) - 2d0ecd4 updated to latest java-properties (#1307)
- 82e03f8 give proper error when
-s
file is missing (#1308) - 6337f4e don't copy classpath files more than once (#1300)
- 97cd36d add missing contributors
- 3ff4446 add code for manikmagar
🧰 Tasks
- b259d74 make codecov less critical
📝 Documentation
Contributors
We'd like to thank the following people for their contributions:
Manik Magar, Tako Schotanus, Max Rydahl Andersen, GitHub
v0.91.0
Changelog
Buckle up - this is a fun release enabling some long-awaited mythical features!
- Aliases for sources:
cat logs.txt | jbang -s prelude@maxandersen -c '$$(l -> l.s(2))'
- Websites as implicit catalog
jbang tree@xam.dk
- Custom JDK Install:
j! jdk install 18 $(sdk home java 18-open)
Details below:
Use of aliases for sources
You can now use an alias to load additional sources, i.e. jbang -s myscript@mycatalog ...
- all thanks to @quintesse super refactoring!.
At first, that might not look that interesting but combining it with the previous release where we added support
for running snippets with jbang -c
you can now load in a custom source that fetches dependencies and add
use case-specific top-level methods and classes.
As an example I'll use Edoardo Vacchi's idea about implementing AWK in JBang using a script called Prelude.jsh
.
Imagine you have a logs.txt
with the following content:
GET /robots.txt HTTP/1.1
HEAD /README.md HTTP/1.1
GET /wp-admin/ HTTP/1.0
And you want to print out all the paths in that log.
There is a ton of ways to do that but if you use raw java it might be quite verbose.
Now with aliases we can cut this down to:
cat logs.txt | jbang -s prelude@evacchi -c '$$(l -> l.s(2))'
This will load the script behind prelude@evacchi
which provides a method named $$
which iterates all input and give you a Line
instance where there are various methods to extract
content, i.e. l.s(2)
gives you the second column.
You can load multiple scripts from anywhere making it possible for everyone to make
interesting toplevel methods available to do useful things like the AWK example above; or maybe
just to make it fun/easier to try out your framework/api.
Looking forward to see what crazy ways you find to use this.
Websites as implicit catalog
Until now jbang's implicit catalogs allow you to have a jbang-catalog
repository, i.e. @maxandersen
was shorthand for catalog found in https://github.com/maxandersen/jbang-catalog
. Very useful to have short and recognizable names.
Thus now if there is a '.' in the name jbang will lookup a website with that name first.
For example: jbang tree@xam.dk
will use the catalog available at https://xam.dk/jbang-catalog.json.
There are more ways this can be used and expanded - those are covered in the docs.
Install of custom JDK's
We've had many requests on having jbang
utilize existing Java installs on your machine rather
than download Java separately. i.e. use sdkman's jdk installs.
We don't do that for various reasons (mainly portability), but with @nandorholozsnyak's great contribution you
can now install custom JDK's using: jbang jdk install <version> <pathtojdk>
.
Example:
Lets say you use sdkman and you want to try out Java 18 with JBang - something that today will fail
unless you have Java 18 installed as default jdk.
You can then run:
j! jdk install 18 `sdk home java 18-open`
which setup the path printed by sdk home java 18-open
to be what what JBang treat as Java 18.
Then you can run:
j! --java 18 -c 'println(javax.lang.model.SourceVersion.RELEASE_18)'
🚀 Features
- 64d7a27 enable jbang tree@jbang.dev and jbang tree@https:/jbang.dev (#1274)
- b9c4b1b Made
--sources script@repo
work (#1283) - c8bcd40 add jbang jdk install (#1252)
🐛 Fixes
- 2dceffb fixed problem with additional sources and aliases (#1284)
- 056ca3b properly quote edit command on Windows (#1279)
- 8a516bb some minor Jshell fixes (#1278)
- 4ffc15f no longer throws NPE for config list (#1276)
- 238ef90 jbang alias list and jbang alias add prints/add empty properties… (#1273)
♻️ Changes
Contributors
We'd like to thank the following people for their contributions:
Tako Schotanus, Max Rydahl Andersen, GitHub, Pierre-Yves Fourmond, Nándor Holozsnyák
v0.90.2
Changelog
Critical fix to avoid untrusted code to run and not auto-install vscode.
Plus if you have a M1 based machine jbang will no longer fail on first run.
jbang will now download Java 17 by default as Java 11 is not yet available from Adoptium.
🐛 Fixes
- 99ed4b8 support M1 initial macs java downloads (#1269)
- ef36242 do not trust nor install editor by default (#1262)
- 81fa1f6 upgrade to latest gradle plugin (#1251)
📝 Documentation
- fd86798 Make explicit why groovy is needed (#1270)
- 5f903c5 Use reload4j in the example instead of log4j (#1266)
- b87d386 [patch] bugfix
Contributors
We'd like to thank the following people for their contributions:
Chromico Rek, Max Rydahl Andersen, GitHub, Jérémie Bresson
v0.90.1
Changelog
Bug fix + add lines(String) top-level method to read a file into lines.
🚀 Features
- 8a25fcf add lines(String) toplevel to read path into stream
🐛 Fixes
- 8e77cef [patch] release
Contributors
We'd like to thank the following people for their contributions:
Tako Schotanus, Max Rydahl Andersen, GitHub
v0.90.0
Changelog
Small changes this time with a big impact.
-i
for interactive without sources
You always could to jbang --interactive <your.java|jsh|jar|gav>
to have jbang
start up your application/script within the jshell interpreter. Which is great but what if you just wanted to try out some API's without having to bother making a file to get started?
Now you can - just use jbang --interactive
or jbang -i
for short and you have a jshell. Of course that in itself is not interesting, but when you combine it with --deps
it does become interesting. i.e. below is an example of starting jbang in interactive mode with access to h2 and jandex libraries.
jbang --deps com.h2database:h2:LATEST,org.jboss:jandex:2.4.2.Final -i
WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.foreign
| Welcome to JShell -- Version 17
| For an introduction type: /help intro
jshell> import org.jboss.jandex.*;
jshell> Index.of(org.h2.Driver.class);
$2 ==> org.jboss.jandex.Index@9f48198
-c
for code snippet execution
jbang
now can execute java code directly allowing you to process standard input to make great one-liners like:
$ echo "hello world" | jbang -c 'lines().forEach(s->println(s.substring(6)))`
world
or this check for how many 5 letter words contains Man's best friend?
$ cat 5letterwords.txt | jbang -c 'lines().filter(s->s.contains("dog")).forEach(p->println(p))'
WARNING: Using incubator modules: jdk.incubator.foreign, jdk.incubator.vector
bedog
dogal
dogey
doges
doggy
doggo
dogie
dogly
dogma
dogra
undog
In the last example you will notice a few things:
-c
enables that the first argument is treated as code instead of a script- a top-level method called 'lines()' is available to read lines from
System.in
println
top-level method is available to easily print.
We got more ideas on adding some top-level methods to enable using java on
the command line.
And of course you can combine -c
with --interactive
and --deps
and even
-s myscripts.jsh
to load your own top-level methods.
Enjoy and Stay tuned :)
🚀 Features
- 2ccc5a1 add lines() to access stdin per line (#1244)
- 9c0b0ca Added
--code
option for running literal scripts (#1243)
- 5922801 [minor] release
Contributors
We'd like to thank the following people for their contributions:
Tako Schotanus, Max Rydahl Andersen, GitHub
v0.89.1
Changelog
0.89 fixes long-standing issue in how jshell was setup with dependencies. Turns out that to have execution AND content-assist working you must specify the classpath twice. Quite bad UX when using 3rd party dependencies but now jbang have it fully working :)
Imagine you have a file named deps.jsh
that uses the Faker library:
///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS https://github.com/blocoio/faker/tree/1.2.8
import io.bloco.faker.Faker;
Faker fake = new Faker("da-DK");
Then you can run it directly using ./deps.jsh
or jbang deps.jsh
but you can also use jbang --interactive deps.jsh
to have some fun with Faker.
2022-02-12_00-42-26.mp4
Compare that to what you would need to write out using raw jshell
:
jshell --execution=local -J--add-modules=ALL-SYSTEM --class-path=/Users/max/.m2/repository/com/github/blocoio/faker/1.2.8/faker-1.2.8.jar:/Users/max/.m2/repository/com/github/bmoliveira/snake-yaml/v1.18-android/snake-yaml-v1.18-android.jar:/Users/max/.m2/repository/joda-time/joda-time/2.9.1/joda-time-2.9.1.jar -J--class-path=/Users/max/.m2/repository/com/github/blocoio/faker/1.2.8/faker-1.2.8.jar:/Users/max/.m2/repository/com/github/bmoliveira/snake-yaml/v1.18-android/snake-yaml-v1.18-android.jar:/Users/max/.m2/repository/joda-time/joda-time/2.9.1/joda-time-2.9.1.jar --startup=DEFAULT --startup=/var/folders/yb/sytszfld4sg8vwr1h0w20jlw0000gn/T/jbang_arguments_12529495078878297375deps.jsh /Users/max/code/personal/jbangdev/jbang/itests/deps.jsh
Simplicity FTW :)
Also include fix (#1232) so jbang init
actually will honor default properties for a template.
Thanks to @nandorholozsnyak and @quintesse!
Full Changelog: v0.88.0...v0.89.1
v0.88.0
Changelog
New JBang release with a bunch of quality of life improvements.
Graphical UI when needed to confirm trust
To simplify install/setup running in a environment where there is no terminal to ask for input, i.e. if using curl
for install
we now show a graphical dialog when needing to confirm trusted URLs or choosing an editor. This was not
an easy decision but it enables to have just one command install, like: curl -Ls https://sh.jbang.dev | bash -s - app install quarkus@quarkusio
Note: this will only show up if needed and AWT/Swing is available, if not the text based info is used instead.
Edit knowing about common editors
When using jbang edit
by default we offered to install and run vscodium - now we also scan PATH for common IDE's like eclipse
, code,
idea` etc. Giving you a choice to use your already installed IDE more easily.
Setting JDK Release
JBang uses foojay.io to download Java Development Kit's normally getting Adoptium major releases.
If you want to try out another distribution and even earlyaccess versions you can now tweak these using environment variables
JBANG_JDK_VENDOR | vendor name, ie. `temurin`, `aoj`, `azul`, `debian`, `microsoft`, `openjdk`, `oracle`, `oracle_open_jdk` or `redhat` |
JBANG_JDK_RELEASE | `ga` or `ea` |
You can set these in your environment or use them directly when calling jbang, i.e.:
JBANG_JDK_VENDOR=oracle JBANG_JDK_RELEASE=ea jbang --java 18 otp.java
This will get latest Java 18 early access release of Oracle JDK.
//SOURCES now supported in .jsh
When using .jsh
(jshell
) //SOURCES
are now supported allowing you to include
other .jsh files.
Catalog can now document its properties
@nandorholozsnyak in his first contribution enabled Catalogs to document its properties
and will be included in jbang catalog list
.
Below are the full list of changes and fixes:
🚀 Features
- dc3fcd9 Use dialog box for input (#1217)
- 430fa70 Catalog templates with property list
- 5de28c2 Quality-of-life improvements for
edit
(#1211) - 08d3512 Allow user to set JDK release (#1225)
🐛 Fixes
- 3367791
//SOURCES
now work in .jsh files too (#1221) - d683e0a Fixed Jbang failing to run correctly with Cygwin (#1226)
- 94508af fixed check for using managed jbang (#1214)
- d888194 headline levels (#1215)
📝 Documentation
- 3adca1b add happyherp as a contributor for doc (#1222)
- 51f1619 add jmini as a contributor for doc (#1213)
- 106be11 Documentation for -P and --property option in template add cli command
Contributors
We'd like to thank the following people for their contributions:
Tako Schotanus, Max Rydahl Andersen, GitHub, Carlos Freund, allcontributors[bot], Nándor Holozsnyák