jbang

Unleash the power of Java - JBang Lets Students, Educators and Professional Developers create, edit and run self-contained source-only Java programs with unprecedented ease.

MIT License

Stars
1.3K
Committers
91

Bot releases are hidden (Show)

jbang - v0.90.1

Published by maxandersen over 2 years ago

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

  • c80c910 showing proper error when using -c without code (#1247)

  • 8e77cef [patch] release

Contributors

We'd like to thank the following people for their contributions:
Tako Schotanus, Max Rydahl Andersen, GitHub

jbang - v0.90.0

Published by maxandersen over 2 years ago

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:

  1. -c enables that the first argument is treated as code instead of a script
  2. a top-level method called 'lines()' is available to read lines from System.in
  3. 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

jbang - v0.89.1

Published by maxandersen over 2 years ago

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.

https://user-images.githubusercontent.com/54129/153685297-b1eccf37-9585-4a6a-b529-e9194cb1734c.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: https://github.com/jbangdev/jbang/compare/v0.88.0...v0.89.1

jbang - v0.88.0

Published by maxandersen over 2 years ago

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

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

jbang - v0.87.0

Published by maxandersen over 2 years ago

Changelog

Bunch of improvements to make things more informative and stable; especially around JDK installs and jbang app install ascript will now verify ascript is buildable.

πŸ› Fixes

  • e23464b app install builds before installing scripts (#1198)
  • 029e218 Fixed JDK download URLs for startup scripts (#1200)
  • 8919f79 failing app setup on Windows (#1196)
  • 43fd95d verbose will now report why build is happening (#1190)
  • df9976f config set/remove should tell what file it edits (#1188)
  • fd729a1 safer good trusted urls, meaning top-level will not be blindly suggested. Fixes #1187

🧰 Tasks

  • ed63dda fix typo in JitPackUtil.java

πŸ“ Documentation

  • 7f97d67 add prafullkotecha as a contributor for doc (#1206)
  • 9a82764 Formatting fixes (#1204)
  • 82de0ae add scottkurz as a contributor for bug (#1197)
  • 68876c0 add basil as a contributor for code (#1191)

  • 21140dc [minor]
  • 0697ac3 Miscellaneous code cleanup (#1158)
  • 443871e Use tagName instead of projectVersion (#1183)

Contributors

We'd like to thank the following people for their contributions:
Basil Crow, Prafull Kotecha, Michael Simons, Tako Schotanus, Ikko Ashimine, Max Rydahl Andersen

New Contributors

Full Changelog: https://github.com/jbangdev/jbang/compare/v0.86.0...v0.87.0

jbang - v0.86.0

Published by maxandersen almost 3 years ago

Changelog

Two years anniversary of JBang, so thought it would be good with a release :)

In this we have a few fixes to get better error information when dependencies cannot resolve and libs gets renamed to lib for consistency during export and a bug fix to jbang tools info making Intellij IDEA JBang plugin work better.

The big news is that JBang now supports using multiple BOM's which is commonly used by frameworks like Quarkus, Spring, or any time you are trying to manage dependencies in larger projects. Give it a try and lets hear how it goes!

Happy New Year!

πŸš€ Features

  • 796c716 support multiple bom poms (#1173)

πŸ› Fixes

  • 446d43f Renaming libs to lib when calling export portable (#1176)
  • b667e55 stop tools info .jsh failing (#1172)
  • 7743693 Provide context about depedendency resolution error. (#1169)

🧰 Tasks

  • e416516 adding missing file
  • 82d8176 make junit annotation gradle aware
  • b40f698 yet another github action annotation with junit
  • d6345ee try different github annotation marker
  • 176c46d enable junit annotation for github actions

πŸ“ Documentation

  • ccbde80 add nandorholozsnyak as a contributor for code (#1177)

  • ba4f82b [minor]
  • 3076eb9 [patch] bugfix for kotlin
  • e5bd7e8 [path] bugfix for kotlin

Contributors

We'd like to thank the following people for their contributions:
Max Rydahl Andersen, GitHub, allcontributors[bot], NΓ‘ndor HolozsnyΓ‘k

jbang - v0.85.1

Published by maxandersen almost 3 years ago

Changelog

Small fixes for Kotlin.

πŸ› Fixes

  • 089f344 rename ".kts" ot ".kt" (#1159)
  • c23cf39 update default Kotlin version to 1.6.10 (#1154)

  • 4370e09 [patch] bugfix for kotlin

Contributors

We'd like to thank the following people for their contributions:
Libing Chen, Max Rydahl Andersen, GitHub

jbang - v0.85.0

Published by maxandersen almost 3 years ago

Changelog

Big release this time!

JBang Config

Every command line argument can now get defaults set using jbang config. You can store the settings globally or using -f=. to have them only take effect in a specific directory tree.

Really useful for setting default editor, i.e. jbang config set edit.open idea to use idea as your default editor.

@quintesse worked hard on this and I'm sure it will save people a lot of extra typing.

Groovy Support

@linux-china showed up contributing Groovy support similar to Kotlin. Still experimental but now you can get all the jbang advantages of compile jars, sharing using catalogs and alias with all the Groovy you like.

Literate Programming with Markdown

JBang will now when you pass it a markdown file like, jbang https://github.com/jbangdev/jbang/blob/main/itests/readme.md it will extract the java/jsh code blocks and treat them as jshell. Allowing you to mix text and code that is both explanatory and runnable.

Embedded GAV

You can now add a //GAV mygroup:artifactid to your file to have it be exported using jbang export mavenrepo without having to list the GAV everytime.

Multiple Deps

--deps on command line now support multiple dependencies separate by a comma(,) to allow much more compact command lines. Thanks to @grumpyf0x48!

Intellij JBang support

@linux-china did not stop with Groovy support he also kicked of Intellij JBang support - give it at try from https://plugins.jetbrains.com/plugin/18257-jbang.

Hope you like this xmas release and when you try any of it out do please leave a comment of feedback on https://github.com/jbangdev/jbang/discussions - we love to hear the good as well as the bad to keep improving JBang !

πŸš€ Features

  • 90f0f2c Allow for a //GAV line in source files (#1133)
  • dfcacb1 Allow jbang to install itself (#1125)
  • 22408da Jbang config (#604)
  • Groovy support (#1113)

πŸ› Fixes

  • 52c6341 updated docs and avoid NPE in integration manager
  • 5a150d9 support running markdown. Fixes #904 (#1139)
  • f2dffa7 Some regressions for Windows (#1121)
  • 0ae08b3 Allow --deps to specify multiple dependencies (#815) (#1141)
  • 1155da1 catalog update doesn't refresh cache (#1124)
  • 73f21f7 Fixed regression not showing catalog names (#1134)

🧰 Tasks

  • 727bc3f fix caching handling for groovycs
  • 151b73d fix broken cache itest
  • adeb522 less me, more we
  • 3f2df0c fix merge errors
  • 51d6a52 codecov only complain if >0.2%
  • 28286c0 explicit source zshrc
  • 46002fa osx uses zsh as default
  • 797d569 add install test starting with osx

πŸ“ Documentation

  • d124ccf add davsclaus as a contributor for bug (#1146)
  • 4b87660 document jbang config
  • 85c3a3c add linux-china as a contributor for code (#1145)
  • ad51f0a document groovy,md and add templates

  • df5f25c [minor] release
  • 768dfae Add "-Dgroovy.grape.enable=false" into runtime options
  • 3811626 helloworld.groovy with Java 11 API
  • fed590c Set JAVA_HOME and unset GROOVY_HOME for groovyc
  • b12bcfa Introduce groovyMajorVersion to check Groovy binary download url
  • 3eb04b8 Correct "groovyc version" to "Groovy version"
  • f4e2162 Add ".groovy" to EXTENSIONS
  • 3e7da7a Add GroovyManager
  • 9343d7b GroovyScriptSource
  • a9ec56f Add GroovyScriptSource for groovy file
  • 8dec1ba Add groovycs in CacheClass for Groovy SDK

Contributors

We'd like to thank the following people for their contributions:
Tako Schotanus, linux_china, Max Rydahl Andersen, GitHub, Pierre-Yves Fourmond, allcontributors[bot]

jbang - v0.84.2

Published by maxandersen almost 3 years ago

Changelog

Get jbang-action publish to work again.

πŸ› Fixes

  • d352f16 fix jbang-action publish

🧰 Tasks

  • 7062a1a [patch] fix jbang-action publishn

Contributors

We'd like to thank the following people for their contributions:
Max Rydahl Andersen

jbang - v0.84.1

Published by maxandersen almost 3 years ago

  • @quintesse cleaned up a bunch of the dependency resolution code giving a bit of speed (by avoiding resolving multiple times) and give more consistency by not having duplicate artifact in the result.
  • Breaking change: before resolution could result in same artifact but different version in result. Now only one wins. As it should be.
  • jbang now should deal more reliably with installs on brand new OSX machines where java and javac are stubbed implementations.
  • you can now add --repos on cli and aliases reliably. This allows you do run a .java file that needs artifacts from other place than just maven central. i.e. jbang --repos jitpack com.github.maxandersen:jbang-to-maven:5877fa86aa
  • main method detection is now handling more edge cases - like if main method are in a non-public class or interface.

Changelog

πŸš€ Features

  • bd8f422 CLI and aliases now allow all dependency options (#1081)

πŸ› Fixes

  • 7c408a6 jdk now works properly on bash in Windows (#1106)
  • 0545cd4 Better deps continued (#1118)
  • 354102e check for javac should now work on Mac (#1112)
  • 090e181 JBang now correctly detects "fake" JDK on MacOS (#1095)
  • bf1da83 Improved main() method lookup (#1104)
  • 0bf47f6 Fixed NPE for info on sources with //SOURCES lines (#1097)
  • 8e3c33c Not using JAVA_HOME anymore if it's invalid (#1105)
  • 2daf2a2 running a JAR with deps no longer resolves twice

🧰 Tasks

  • 153b18e [minor]
  • 47111d3 add git bisect example/support files
  • 6173f79 enable code coverage (#448)
  • 4419325 Update release settings for JReleaser 0.9 (#1079)
  • 15c0d05 dont auto build
  • 597860f add shortcut links for issue creation

πŸ›  Build

  • e1af874 Fixed build for Java 8 (#1098)

πŸ“ Documentation

  • 2b98221 clean up cli doc
  • 925625d updated docs for --repos
  • fc7e1c0 update cli generated docs

Contributors

We'd like to thank the following people for their contributions:
Tako Schotanus, Andres Almiray, Max Rydahl Andersen, GitHub, Geoffrey De Smet

Contributors

We'd like to thank the following people for their contributions:
Tako Schotanus, Max Rydahl Andersen, GitHub, allcontributors[bot]

jbang - v0.83.1

Published by maxandersen almost 3 years ago

Changelog

Quick fix release to fix brew installs that accidentally downloaded jbang into ~/.jbang/bin as it could not find the brew installed jar + fix for jbang init help message.

Fixes

  • 9a3a425 brew install no longer downloading jbang into ~/.jbang/bin
  • 875caba Regression regarding issue 1019 (#1057)

Tasks

  • 7e271fc [patch]

Contributors

We'd like to thank the following people for their contributions:
Max Rydahl Andersen, GitHub, Pierre-Yves Fourmond

jbang - v0.83.0

Published by maxandersen almost 3 years ago

Changelog

Small minor, Quarkus devmode and properties handling now back and brew should not complain about deprecated instructions.

Fixes

  • 1b46fec restore system level properties for build integration. (#1062)
  • 3d79496 install java tools when using codespaces
  • afae503 devcontainer.json and include version.txt
  • 53a1622 remove unneeded for brew. Fixes #1053

Tasks

  • 1d29306 fix build.gradle

Documentation

  • 3197cff add michael-simons as a contributor for doc (#1049)
  • 653fe57 add TomerFi as a contributor for doc (#1055)
  • 9909f38 fixed command for updating jbang using sdkman (#1052)
  • 8a05433 add skabashnyuk as a contributor for bug (#1054)

Contributors

We'd like to thank the following people for their contributions:
Tomer Figenblat, Max Rydahl Andersen, GitHub, allcontributors[bot]

jbang - v0.82.1

Published by maxandersen almost 3 years ago

Bug caused jbang/jbang.cmd not being included in distribution. Now reverted until proper fix in place.

Changelog

  • 803ddab [patch]
  • 9b3dda9 Revert "Startup scripts now use User-Agent header for downloads (#1037)"

Contributors

We'd like to thank the following people for their contributions:
Max Rydahl Andersen

jbang - v0.82.0

Published by maxandersen almost 3 years ago

Various fixes and a small but useful addition to jbang init.

Lets us have jbang create a starting file with dependencies already filled in avoiding to do an extra round trip. I.e. to start using prettyTime do: `jbang init β€”deps org.ocpsoft.prettytime:prettytime:5.0.2.Final trickortreat.Java

Features

  • a1acc49 jbang init --deps (#1046)
  • 013f328 Startup scripts now use User-Agent header for downloads (#1037)

Fixes

  • 3adf1b5 Do not force .java suffix for Quarkus based templates (#1039)
  • 47e2a81 This fixes extraneous jbang.cmd output (#1041)
  • ea65d99 add hint to user they can get updated catalog using --fresh (#1040)
  • 8ac258c No longer pass Accept header (#1036)

Changes

  • fe08627 Simplified jbang.cmd (#1038)

Documentation

  • bda315f Add missing "`". (#1048)

  • c156a6d [minor]
  • c0d20d4 use jrelaser 0.8

Contributors

We'd like to thank the following people for their contributions:
Rostislav Svoboda, Tako Schotanus, Michael Simons, Max Rydahl Andersen, GitHub

jbang - v0.81.2

Published by maxandersen about 3 years ago

Changelog

Linux had issues downloading Java when no java available. Now fixed.

πŸ› Fixes

  • 275d31a archive type for foojay. Fixes #1035

  • 95a715e [patch] fix linux based java download

Contributors

We'd like to thank the following people for their contributions:
Max Rydahl Andersen

jbang - v0.81.1

Published by maxandersen about 3 years ago

Changelog

πŸ› Fixes

  • 98866f1 Add itest for issue #1019 (#1033)
  • 20514c7 Now really fixed updating on Windows (#1031)

  • d42951d [patch]

Contributors

We'd like to thank the following people for their contributions:
Tako Schotanus, Max Rydahl Andersen, GitHub, Pierre-Yves Fourmond

jbang - v0.81.0

Published by maxandersen about 3 years ago

Changelog

Bugfixes but also that --deps on command line works properly with javafx so you now can for example run all the examples in @hansolo's charts library like this:

jbang --java 17 --deps org.openjfx:javafx-graphics:17:mac --deps eu.hansolo.fx:charts:RELEASE https://github.com/HanSolo/charts/blob/master/src/test/java/eu/hansolo/fx/charts/SankeyPlotTest.java

Also JBANG_EDITOR is once again honored by jbang edit.

πŸ› Fixes

  • 7419590 edit now honors JBANG_EDITOR again
  • 3955647 Not checking for new version on first run anymore (#1023)
  • 5e16e22 jbang edit suggests incorrect command when template renames out… (#1020)
  • 3ac5561 --deps now gets special javafx treatments as //DEPS does (#1017)
  • 52b2377 Fixed link to "Usage on Windows" (#1026)
  • 8d5ea6a Fixed download URL in jbang script (#1021)
  • b750ebb kotlin edit now link to source rather than cache location (#1015)

🧰 Tasks

  • fb45502 use jreleaser 0.7
  • 6f87c70 eliminate warnings from code base (#1011)

πŸ“ Documentation

  • f842666 Update spotless pre-commit hook url (#1009)

  • 9ed4116 [minor]

Contributors

We'd like to thank the following people for their contributions:
Oliver Libutzki, Tako Schotanus, Max Rydahl Andersen, GitHub, Pierre-Yves Fourmond, Fred Bricon

jbang - v0.80.2

Published by maxandersen about 3 years ago

Changelog

Fixes so latest Adoptium / Temurin release is downloadable.

πŸ› Fixes

  • f6a32db use termurin for java 17
  • da0c971 proper nuget

🧰 Tasks

  • 43b2c72 remove j'bang from choco name, its just JBang

  • d297667 [patch] fix java 17 downloads

Contributors

We'd like to thank the following people for their contributions:
Max Rydahl Andersen

jbang - v0.80.1

Published by maxandersen about 3 years ago

Changelog

Choco build was broken in release due to change in nuget - hopefully now fixed.

πŸ› Fixes

  • f1da23b choco build

  • 30cf637 [patch]

Contributors

We'd like to thank the following people for their contributions:
Max Rydahl Andersen

jbang - v0.80.0

Published by maxandersen about 3 years ago

Easier (but breaking) edit and foojay.io!

jbang edit now will open editor by default as opposed before you needed to do jbang edit --open. If you want the old behavior use jbang edit --no-open. This change is because if you really use edit it gets very tedious to write and many users did not seem to realise what jbang edit actually can do.

foojay.io for JDK Downloads

With adoptopenjdk.net moving to Eclipse Adoptium we have the challenge that neither of their apis will give access to the full range of builds. Thus we moved to use api.foojay.io instead. Should not change anything for you as user but in case you see jbang fail to download/install a JDK where it worked before please let us know!

Other minor fixes and features found below!

Changelog

πŸš€ Features

  • 898bc3a add --java-options (#989)

πŸ› Fixes

  • 5ea6fc2 use disco/foojay instead of adoptopenjdk to get api that works with old and new jdk versions (#1003)
  • d43d1d4 baseName is no longer ambiguous (#999)
  • 5625dd9 404s won't fail catalog list/update commands anymore (#997)

🧰 Tasks

  • 4fc3384 fix jreleaser sdkman
  • e6a3a95 it is JBang not Jbang thus search/replace to fix it once and for all (#1001)
  • 95dade4 use pattern instead of change

  • 6edf958 [minor]
  • 46fa108 [fix] Make sure version --update works on Windows (#996)
  • 31a4008 [fix] Fixed version updates (#995)
  • 0d4d203 fix!: make edit open by default and add --no-open (#994)

Contributors

We'd like to thank the following people for their contributions:
Tako Schotanus, Max Rydahl Andersen, GitHub

Package Rankings
Top 6.73% on Proxy.golang.org