Class MavenRunner

java.lang.Object
com.vaadin.hilla.engine.commandrunner.MavenRunner
All Implemented Interfaces:
CommandRunner

public class MavenRunner extends Object implements CommandRunner
Runs a Maven command.
  • Constructor Details

    • MavenRunner

      public MavenRunner(File projectDir, String... args)
      Creates a Maven runner.
      Parameters:
      projectDir - the project directory
      args - the arguments to pass to Maven
  • Method Details

    • forProject

      public static Optional<CommandRunner> forProject(File projectDir, String... args)
      Creates a Maven runner for the given project directory.
      Parameters:
      projectDir - the project directory
      args - the arguments to pass to Maven
      Returns:
      a Maven runner if the project directory contains a Maven project, an empty optional otherwise
    • arguments

      public String[] arguments()
      Description copied from interface: CommandRunner
      Get the arguments to use when running the command.
      Specified by:
      arguments in interface CommandRunner
      Returns:
      the arguments to use when running the command
    • testArguments

      public String[] testArguments()
      Description copied from interface: CommandRunner
      Get the arguments to use when testing if the command is available.
      Specified by:
      testArguments in interface CommandRunner
      Returns:
      the arguments to use when testing if the command is available
    • getLogger

      public org.slf4j.Logger getLogger()
      Description copied from interface: CommandRunner
      Get the logger to use.
      Specified by:
      getLogger in interface CommandRunner
      Returns:
      the logger to use
    • currentDirectory

      public File currentDirectory()
      Description copied from interface: CommandRunner
      Get the directory to run the command in.
      Specified by:
      currentDirectory in interface CommandRunner
      Returns:
      the directory to run the command in
    • executables

      public List<String> executables()
      Description copied from interface: CommandRunner
      Get the executables to try, in order of preference.
      Specified by:
      executables in interface CommandRunner
      Returns:
      the executables to try