Merge pull request #11489 from maxandersen/jbangguide
BAEL-5101 Guide to jbang source code
This commit is contained in:
commit
95d96e0d31
|
@ -0,0 +1,11 @@
|
|||
///usr/bin/env jbang "$0" "$@" ; exit $?
|
||||
// //DEPS <dependency1> <dependency2>
|
||||
|
||||
import static java.lang.System.*;
|
||||
|
||||
public class hello {
|
||||
|
||||
public static void main(String... args) {
|
||||
out.println("Hello World");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
///usr/bin/env jbang "$0" "$@" ; exit $?
|
||||
//DEPS info.picocli:picocli:4.5.0
|
||||
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Parameters;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
@Command(name = "hellocli", mixinStandardHelpOptions = true, version = "hellocli 0.1",
|
||||
description = "hellocli made with jbang")
|
||||
class hellocli implements Callable<Integer> {
|
||||
|
||||
@Parameters(index = "0", description = "The greeting to print", defaultValue = "World!")
|
||||
private String greeting;
|
||||
|
||||
public static void main(String... args) {
|
||||
int exitCode = new CommandLine(new hellocli()).execute(args);
|
||||
System.exit(exitCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer call() throws Exception { // your business logic goes here...
|
||||
System.out.println("Hello " + greeting);
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>JBang meets Quarkus</title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a href="/hello">Go Say Hello!</a>
|
||||
<p>
|
||||
Powered by:
|
||||
<a href="https://jbang.dev"><img src="https://www.jbang.dev/assets/images/logo.png"/></a>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"catalogs": {},
|
||||
"aliases": {
|
||||
"hello": {
|
||||
"script-ref": "hello.java"
|
||||
},
|
||||
"hellocli": {
|
||||
"script-ref": "hellocli.java"
|
||||
},
|
||||
"jbangquarkus": {
|
||||
"script-ref": "jbangquarkus.java"
|
||||
}
|
||||
},
|
||||
"templates": {}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
///usr/bin/env jbang "$0" "$@" ; exit $?
|
||||
// Update the Quarkus version to what you want here or run jbang with
|
||||
// `-Dquarkus.version=<version>` to override it.
|
||||
//DEPS io.quarkus:quarkus-bom:${quarkus.version:2.4.0.Final}@pom
|
||||
//DEPS io.quarkus:quarkus-resteasy
|
||||
//JAVAC_OPTIONS -parameters
|
||||
|
||||
//FILES META-INF/resources/index.html=index.html
|
||||
|
||||
import javax.enterprise.context.ApplicationScoped;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/hello")
|
||||
@ApplicationScoped
|
||||
public class jbangquarkus {
|
||||
@GET
|
||||
public String sayHello() {
|
||||
return "Hello from Quarkus with jbang.dev";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue