github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/e2e/isolation/input/java.nomad (about)

     1  job "java_pid" {
     2    datacenters = ["dc1"]
     3    type        = "batch"
     4  
     5    group "java" {
     6  
     7      task "build" {
     8        lifecycle {
     9          hook    = "prestart"
    10          sidecar = false
    11        }
    12  
    13        driver = "exec"
    14        config {
    15          command = "javac"
    16          args    = ["-d", "${NOMAD_ALLOC_DIR}", "local/Pid.java"]
    17        }
    18  
    19        template {
    20          destination = "local/Pid.java"
    21          data        = <<EOH
    22  public class Pid {
    23      public static void main(String... s) throws Exception {
    24          System.out.println("my pid is " + ProcessHandle.current().pid());
    25      }
    26  }
    27  EOH
    28        }
    29      }
    30  
    31      task "pid" {
    32        driver = "java"
    33        config {
    34          class_path = "${NOMAD_ALLOC_DIR}"
    35          class      = "Pid"
    36        }
    37      }
    38    }
    39  }