Skip to content

Commit a75109d

Browse files
authored
Merge pull request quarkusio#32028 from zakkak/2023-03-22-doc-fix
Update scripting guide
2 parents 62ef5f6 + a0b59dc commit a75109d

File tree

1 file changed

+42
-40
lines changed

1 file changed

+42
-40
lines changed

docs/src/main/asciidoc/scripting.adoc

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ import jakarta.ws.rs.GET;
4242
import jakarta.ws.rs.Path;
4343
import jakarta.ws.rs.Produces;
4444
import jakarta.ws.rs.core.MediaType;
45-
import org.jboss.logging.Logger;
4645
4746
@Path("/hello")
4847
@ApplicationScoped
@@ -136,9 +135,9 @@ $ jbang quarkusapp.java
136135
[jbang] Dependencies resolved
137136
[jbang] Building jar...
138137
[jbang] Post build with io.quarkus.launcher.JBangIntegration
139-
Aug 30, 2020 5:40:55 AM org.jboss.threads.Version <clinit>
140-
INFO: JBoss Threads version 3.1.1.Final
141-
Aug 30, 2020 5:40:56 AM io.quarkus.deployment.QuarkusAugmentor run
138+
Mar 22, 2023 9:47:51 A.M. org.jboss.threads.Version <clinit>
139+
INFO: JBoss Threads version 3.5.0.Final
140+
Mar 22, 2023 9:47:51 A.M. io.quarkus.deployment.QuarkusAugmentor run
142141
INFO: Quarkus augmentation completed in 722ms
143142
Hello World
144143
----
@@ -148,13 +147,9 @@ For now the application does nothing new.
148147
[TIP]
149148
.How do I edit this file and get content assist?
150149
====
151-
As there is nothing but a `.java` file, most IDE's don't handle content assist well.
152-
To work around that you can run `jbang edit quarkusapp.java`, this will print out a directory that will have a temporary project setup you can use in your IDE.
150+
To edit the JBang script in an IDE/editor with content assist you can run `jbang edit quarkusapp.java` or `jbang edit quarkusapp.java`.
153151
154-
On Linux/macOS you can run `<idecommand> `jbang edit quarkusapp.java``.
155-
156-
If you add dependencies while editing, you can get JBang to automatically refresh
157-
the IDE project using `jbang edit --live=<idecommand> quarkusapp.java`.
152+
For more information please refer to the https://www.jbang.dev/documentation/guide/latest/editing.html[the JBang documentation].
158153
====
159154

160155

@@ -204,17 +199,17 @@ $ jbang quarkusapp.java
204199
205200
[jbang] Building jar...
206201
[jbang] Post build with io.quarkus.launcher.JBangIntegration
207-
Aug 30, 2020 5:49:01 AM org.jboss.threads.Version <clinit>
208-
INFO: JBoss Threads version 3.1.1.Final
209-
Aug 30, 2020 5:49:02 AM io.quarkus.deployment.QuarkusAugmentor run
210-
INFO: Quarkus augmentation completed in 681ms
202+
Mar 22, 2023 9:48:39 A.M. org.jboss.threads.Version <clinit>
203+
INFO: JBoss Threads version 3.5.0.Final
204+
Mar 22, 2023 9:48:39 A.M. io.quarkus.deployment.QuarkusAugmentor run
205+
INFO: Quarkus augmentation completed in 521ms
211206
__ ____ __ _____ ___ __ ____ ______
212207
--/ __ \/ / / / _ | / _ \/ //_/ / / / __/
213208
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
214209
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
215-
2020-08-30 05:49:03,255 INFO [io.quarkus] (main) Quarkus {quarkus-version} on JVM started in 0.638s. Listening on: http://0.0.0.0:8080
216-
2020-08-30 05:49:03,272 INFO [io.quarkus] (main) Profile prod activated.
217-
2020-08-30 05:49:03,272 INFO [io.quarkus] (main) Installed features: [cdi, resteasy-reactive]
210+
2023-03-22 09:48:39,891 INFO [io.quarkus] (main) quarkus 999-SNAPSHOT on JVM (powered by Quarkus {quarkus-version}) started in 0.283s. Listening on: http://0.0.0.0:8080
211+
2023-03-22 09:48:39,904 INFO [io.quarkus] (main) Profile prod activated.
212+
2023-03-22 09:48:39,904 INFO [io.quarkus] (main) Installed features: [cdi, resteasy-reactive, smallrye-context-propagation, vertx]
218213
----
219214

220215
Once started, you can request the provided endpoint:
@@ -281,7 +276,8 @@ Edit the `quarksapp` class to inject the `GreetingService` and create a new endp
281276
[source,java,subs=attributes+]
282277
----
283278
//usr/bin/env jbang "$0" "$@" ; exit $?
284-
//DEPS io.quarkus:quarkus-resteasy-reactive:{quarkus-version}
279+
//DEPS io.quarkus.platform:quarkus-bom:{quarkus-version}@pom
280+
//DEPS io.quarkus:quarkus-resteasy-reactive
285281
286282
import io.quarkus.runtime.Quarkus;
287283
import jakarta.enterprise.context.ApplicationScoped;
@@ -297,7 +293,7 @@ public class quarkusapp {
297293
298294
@GET
299295
public String sayHello() {
300-
return "hello from Quarkus with jbang.dev";
296+
return "hello";
301297
}
302298
303299
public static void main(String[] args) {
@@ -393,34 +389,40 @@ Now during build the `quarkus.swagger-ui.always-include` will be generated into
393389

394390
== Running as a native application
395391

396-
If you have the `native-image` binary installed and `GRAALVM_HOME` set, you can get the native executable built and run using `jbang --native quarkusapp.java`:
392+
If you have the `native-image` binary installed and `GRAALVM_HOME` set, or a container runtime (e.g., podman or docker) installed on Linux, you can get the native executable built and run using `jbang --native quarkusapp.java`:
397393

398394
[source,shell,subs=attributes+]
399395
----
400396
$ jbang --native quarkusapp.java
401-
402397
[jbang] Building jar...
403398
[jbang] Post build with io.quarkus.launcher.JBangIntegration
404-
Aug 30, 2020 6:21:15 AM org.jboss.threads.Version <clinit>
405-
INFO: JBoss Threads version 3.1.1.Final
406-
Aug 30, 2020 6:21:16 AM io.quarkus.deployment.pkg.steps.JarResultBuildStep buildNativeImageThinJar
407-
INFO: Building native image source jar: /var/folders/yb/sytszfld4sg8vwr1h0w20jlw0000gn/T/quarkus-jbang3291688251685023074/quarkus-application-native-image-source-jar/quarkus-application-runner.jar
408-
Aug 30, 2020 6:21:16 AM io.quarkus.deployment.pkg.steps.NativeImageBuildStep build
409-
INFO: Building native image from /var/folders/yb/sytszfld4sg8vwr1h0w20jlw0000gn/T/quarkus-jbang3291688251685023074/quarkus-application-native-image-source-jar/quarkus-application-runner.jar
410-
Aug 30, 2020 6:21:16 AM io.quarkus.deployment.pkg.steps.NativeImageBuildStep checkGraalVMVersion
411-
INFO: Running Quarkus native-image plugin on GraalVM Version 20.1.0 (Java Version 11.0.7)
412-
Aug 30, 2020 6:21:16 AM io.quarkus.deployment.pkg.steps.NativeImageBuildStep build
413-
INFO: /Users/max/.sdkman/candidates/java/20.1.0.r11-grl/bin/native-image -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 -J-Duser.language=en -J-Dfile.encoding=UTF-8 --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -jar quarkus-application-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http --no-server -H:-UseServiceLoaderFeature -H:+StackTrace quarkus-application-runner
414-
415-
Aug 30, 2020 6:22:31 AM io.quarkus.deployment.QuarkusAugmentor run
416-
INFO: Quarkus augmentation completed in 76010ms
399+
Mar 22, 2023 9:58:47 A.M. org.jboss.threads.Version <clinit>
400+
INFO: JBoss Threads version 3.5.0.Final
401+
Mar 22, 2023 9:58:47 A.M. io.quarkus.deployment.pkg.steps.JarResultBuildStep buildNativeImageThinJar
402+
INFO: Building native image source jar: /tmp/quarkus-jbang8082065952748314720/quarkus-application-native-image-source-jar/quarkus-application-runner.jar
403+
Mar 22, 2023 9:58:47 A.M. io.quarkus.deployment.pkg.steps.NativeImageBuildStep build
404+
INFO: Building native image from /tmp/quarkus-jbang8082065952748314720/quarkus-application-native-image-source-jar/quarkus-application-runner.jar
405+
Mar 22, 2023 9:58:47 A.M. io.quarkus.deployment.pkg.steps.NativeImageBuildStep getNativeImageBuildRunner
406+
WARN: Cannot find the `native-image` in the GRAALVM_HOME, JAVA_HOME and System PATH. Install it using `gu install native-image` Attempting to fall back to container build.
407+
Mar 22, 2023 9:58:47 A.M. io.quarkus.deployment.pkg.steps.NativeImageBuildContainerRunner <init>
408+
INFO: Using docker to run the native image builder
409+
Mar 22, 2023 9:58:47 A.M. io.quarkus.deployment.pkg.steps.NativeImageBuildContainerRunner setup
410+
INFO: Checking image status quay.io/quarkus/ubi-quarkus-mandrel-builder-image:22.3-java17
411+
Mar 22, 2023 9:58:51 A.M. io.quarkus.deployment.pkg.steps.NativeImageBuildStep checkGraalVMVersion
412+
INFO: Running Quarkus native-image plugin on native-image 22.3.1.0-Final Mandrel Distribution (Java Version 17.0.6+10)
413+
Mar 22, 2023 9:58:51 A.M. io.quarkus.deployment.pkg.steps.NativeImageBuildRunner build
414+
INFO: docker run --env LANG=C --rm --user 1000:1000 -v /tmp/quarkus-jbang8082065952748314720/quarkus-application-native-image-source-jar:/project:z --name build-native-XaZUc quay.io/quarkus/ubi-quarkus-mandrel-builder-image:22.3-java17 -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dlogging.initial-configurator.min-level=500 -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.noUnsafe=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=3 -J-Duser.language=en -J-Duser.country=IE -J-Dfile.encoding=UTF-8 --features=io.quarkus.runner.Feature,io.quarkus.runtime.graal.DisableLoggingFeature -J--add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED -J--add-opens=java.base/java.text=ALL-UNNAMED -J--add-opens=java.base/java.io=ALL-UNNAMED -J--add-opens=java.base/java.lang.invoke=ALL-UNNAMED -J--add-opens=java.base/java.util=ALL-UNNAMED -H:+CollectImageBuildStatistics -H:ImageBuildStatisticsFile=quarkus-application-runner-timing-stats.json -H:BuildOutputJSONFile=quarkus-application-runner-build-output-stats.json -H:+AllowFoldMethods -J-Djava.awt.headless=true --no-fallback --link-at-build-time -H:+ReportExceptionStackTraces -H:-AddAllCharsets --enable-url-protocols=http -H:NativeLinkerOption=-no-pie -H:-UseServiceLoaderFeature -H:+StackTrace -J--add-exports=org.graalvm.sdk/org.graalvm.nativeimage.impl=ALL-UNNAMED --exclude-config io\.netty\.netty-codec /META-INF/native-image/io\.netty/netty-codec/generated/handlers/reflect-config\.json --exclude-config io\.netty\.netty-handler /META-INF/native-image/io\.netty/netty-handler/generated/handlers/reflect-config\.json quarkus-application-runner -jar quarkus-application-runner.jar
415+
Mar 22, 2023 9:37:56 A.M. io.quarkus.deployment.pkg.steps.NativeImageBuildRunner runCommand
416+
INFO: docker run --env LANG=C --rm --user 1000:1000 -v /tmp/quarkus-jbang9315448339582904220/quarkus-application-native-image-source-jar:/project:z --entrypoint /bin/bash quay.io/quarkus/ubi-quarkus-mandrel-builder-image:22.3-java17 -c objcopy --strip-debug quarkus-application-runner
417+
Mar 22, 2023 9:37:57 A.M. io.quarkus.deployment.QuarkusAugmentor run
418+
INFO: Quarkus augmentation completed in 31729ms
417419
__ ____ __ _____ ___ __ ____ ______
418420
--/ __ \/ / / / _ | / _ \/ //_/ / / / __/
419421
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
420422
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
421-
2020-08-30 06:22:32,012 INFO [io.quarkus] (main) Quarkus {quarkus-version} native started in 0.017s. Listening on: http://0.0.0.0:8080
422-
2020-08-30 06:22:32,013 INFO [io.quarkus] (main) Profile prod activated.
423-
2020-08-30 06:22:32,013 INFO [io.quarkus] (main) Installed features: [cdi, resteasy-reactive]
423+
2023-03-22 09:37:57,471 INFO [io.quarkus] (main) quarkus 999-SNAPSHOT native (powered by {quarkus-version}) started in 0.009s. Listening on: http://0.0.0.0:8080
424+
2023-03-22 09:37:57,472 INFO [io.quarkus] (main) Profile prod activated.
425+
2023-03-22 09:37:57,472 INFO [io.quarkus] (main) Installed features: [cdi, resteasy-reactive, smallrye-context-propagation, vertx]
424426
----
425427

426428
This native build will take some time on first run but any subsequent runs (without changing `quarkusapp.java`) will be close to instant thanks to JBang cache:
@@ -432,9 +434,9 @@ __ ____ __ _____ ___ __ ____ ______
432434
--/ __ \/ / / / _ | / _ \/ //_/ / / / __/
433435
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
434436
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
435-
2020-08-30 06:23:36,846 INFO [io.quarkus] (main) Quarkus {quarkus-version} native started in 0.015s. Listening on: http://0.0.0.0:8080
436-
2020-08-30 06:23:36,846 INFO [io.quarkus] (main) Profile prod activated.
437-
2020-08-30 06:23:36,846 INFO [io.quarkus] (main) Installed features: [cdi, resteasy-reactive]
437+
2023-03-22 09:38:45,450 INFO [io.quarkus] (main) quarkus 999-SNAPSHOT native (powered by {quarkus-version}) started in 0.009s. Listening on: http://0.0.0.0:8080
438+
2023-03-22 09:38:45,450 INFO [io.quarkus] (main) Profile prod activated.
439+
2023-03-22 09:38:45,450 INFO [io.quarkus] (main) Installed features: [cdi, resteasy-reactive, smallrye-context-propagation, vertx]
438440
----
439441

440442
=== Conclusion

0 commit comments

Comments
 (0)