Class TrainTask

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
com.patbaumgartner.optimizer.gradle.TrainTask
All Implemented Interfaces:
Comparable<org.gradle.api.Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.TaskInternal, org.gradle.api.Named, org.gradle.api.plugins.ExtensionAware, org.gradle.api.Task, org.gradle.util.Configurable<org.gradle.api.Task>

@DisableCachingByDefault(because="Runs an external Spring Boot process whose output depends on the environment") public abstract class TrainTask extends org.gradle.api.DefaultTask
Gradle task that runs a Spring Boot application in training mode to detect which auto-configurations are loaded.
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.gradle.api.Named

    org.gradle.api.Named.Namer
  • Field Summary

    Fields inherited from interface org.gradle.api.Task

    TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new TrainTask.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract org.gradle.api.file.ConfigurableFileCollection
    The directories containing compiled class files to scan for the main class when neither jar nor mainClass is configured.
    abstract org.gradle.api.file.RegularFileProperty
    The Spring Boot executable JAR to run.
    abstract org.gradle.api.provider.ListProperty<String>
    Additional JVM arguments for the training run.
    abstract org.gradle.api.provider.Property<String>
    The main class of the Spring Boot application.
    abstract org.gradle.api.file.DirectoryProperty
    The output directory for the generated properties file.
    abstract org.gradle.api.provider.Property<String>
    The name of the generated properties file.
    abstract org.gradle.api.provider.ListProperty<File>
    The classpath for running the application.
    abstract org.gradle.api.provider.Property<Integer>
    The training run timeout in seconds.
    void
    Executes the training run.

    Methods inherited from class org.gradle.api.DefaultTask

    compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService

    Methods inherited from class org.gradle.api.internal.AbstractTask

    acceptServiceReferences, appendParallelSafeAction, doNotTrackState, doNotTrackStateIf, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, setImpliesSubProjects

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.gradle.api.Task

    doNotTrackState, notCompatibleWithConfigurationCache
  • Constructor Details

    • TrainTask

      public TrainTask()
      Creates a new TrainTask.
  • Method Details

    • getMainClass

      @Input @Optional public abstract org.gradle.api.provider.Property<String> getMainClass()
      The main class of the Spring Boot application.
      Returns:
      the main class property
    • getJar

      @InputFile @PathSensitive(NONE) @Optional public abstract org.gradle.api.file.RegularFileProperty getJar()
      The Spring Boot executable JAR to run.
      Returns:
      the JAR file property
    • getRuntimeClasspath

      @Classpath @Optional public abstract org.gradle.api.provider.ListProperty<File> getRuntimeClasspath()
      The classpath for running the application.
      Returns:
      the runtime classpath list property
    • getClassesDirectories

      @InputFiles @Classpath @Optional public abstract org.gradle.api.file.ConfigurableFileCollection getClassesDirectories()
      The directories containing compiled class files to scan for the main class when neither jar nor mainClass is configured.
      Returns:
      the classes directories file collection
    • getJvmArguments

      @Input @Optional public abstract org.gradle.api.provider.ListProperty<String> getJvmArguments()
      Additional JVM arguments for the training run.
      Returns:
      the JVM arguments list property
    • getTimeoutSeconds

      @Input public abstract org.gradle.api.provider.Property<Integer> getTimeoutSeconds()
      The training run timeout in seconds.
      Returns:
      the timeout property
    • getOutputDirectory

      @OutputDirectory public abstract org.gradle.api.file.DirectoryProperty getOutputDirectory()
      The output directory for the generated properties file.
      Returns:
      the output directory property
    • getOutputFile

      @Input public abstract org.gradle.api.provider.Property<String> getOutputFile()
      The name of the generated properties file.
      Returns:
      the output file name property
    • train

      public void train() throws IOException, InterruptedException
      Executes the training run.
      Throws:
      IOException - if an I/O error occurs during process execution
      InterruptedException - if the training process is interrupted