Class TrainingRun

java.lang.Object
io.micronaut.maven.jdkaotcache.TrainingRun

@Internal public final class TrainingRun extends Object
The JDK AOT cache training run of an application: the mode, and what ends the run. It is resolved from micronaut.docker.jdkAotCache.trainingMode, the training paths and what the application's Micronaut version can do.

Without a configured mode, the run is a LOAD run if the Micronaut version has that mode, because it creates no bean and so needs none of the services the beans use, which an image build does not have. Otherwise, it starts the application, as every Micronaut version can.

Since:
5.1.0
Author:
Álvaro Sánchez-Mariscal
  • Method Details

    • resolve

      public static TrainingRun resolve(@Nullable TrainingMode configured, List<String> trainingPaths, Collection<org.apache.maven.artifact.Artifact> artifacts) throws org.apache.maven.plugin.MojoExecutionException
      Parameters:
      configured - the configured micronaut.docker.jdkAotCache.trainingMode, or null if it is not set
      trainingPaths - the validated training paths
      artifacts - the resolved dependencies of the application
      Returns:
      the training run
      Throws:
      org.apache.maven.plugin.MojoExecutionException - if the application's Micronaut version cannot run the mode, or if training paths are set for a run that does not start the application
    • usesSwitch

      public boolean usesSwitch()
      Returns:
      whether the Micronaut training-run switch ends the run. Otherwise, the training script warms the application up and stops it with SIGTERM
    • log

      public void log(org.apache.maven.plugin.logging.Log log)
      Writes what the run does and why to the build log, and the warning, if there is one.
      Parameters:
      log - the Maven log
    • logGeneratedDockerfileRun

      public void logGeneratedDockerfileRun(org.apache.maven.plugin.logging.Log log)
      Writes what log(Log) writes and, for a run that starts the application, how the training script of the generated Dockerfile ends it.
      Parameters:
      log - the Maven log
    • scriptArgument

      Returns:
      the argument that tells the training script how to run the application: load, switch or sigterm