If you want the generated jar or native binary you can use jbang export local <script> to get it copied (exported) for you to use directly.

Note, the local generated jar will have classpath references that are machine dependent. If you want a portable jar use jbang export portable <script> and the dependent jars will be put in libs directory and generated jar will have relative references to the jars in the libs folder.

Exporting to Maven Repository

If your application or script need to be used from another java project it can be beneficial to publish your jar into a maven repository. You can use jbang export mavenrepo -Dgroup=dk.xam yourapp.java to have it installed in your default maven repository, or use -O target to get it exported to a directory named target.

You can control what maven coordinate will be used via properties named group, artifact and version.

Publish via jitpack

You can use export mavenrepo to publish any github hosted jbang app into a maven project by using a jitpack.yml as follows:

  -  curl -Ls https://sh.jbang.dev | bash -s - app setup
  - ~/.jbang/bin/jbang export mavenrepo --force -O target -Dgroup=$GROUP -Dartifact=$ARTIFACT -Dversion=$VERSION hello.java
  - mkdir -p ~/.m2/repository
  - cp -rv target/* ~/.m2/repository/

You should only need to change hello.java to match your application/script.

You can read more about how jitpack handle builds at https://jitpack.io/docs/BUILDING/.