Class DockerExeExecutor

java.lang.Object
org.apache.maven.executor.support.ProcessBuilderExecutorSupport
org.apache.maven.executor.providers.dockerexe.DockerExeExecutor
All Implemented Interfaces:
AutoCloseable, Executor

public class DockerExeExecutor extends ProcessBuilderExecutorSupport implements Executor
Executor that spawns a process with docker CLI to execute request.
  • Field Details

  • Constructor Details

    • DockerExeExecutor

      protected DockerExeExecutor(String imageName, String imageTag)
  • Method Details

    • withMavenImageVersion

      public static DockerExeExecutor withMavenImageVersion(String mavenVersion)
      Method to create executor that will use Maven Docker image with given tag (Maven version).
      Parameters:
      mavenVersion - required param, the Maven version, not null.
    • withImage

      public static DockerExeExecutor withImage(String imageName, String imageTag)
      Method to create executor that will use given Docker image with optionally provided tag.
      Parameters:
      imageName - required param, the image name to use, not null.
      imageTag - optional param, the image tag, may be null.
    • execute

      public ExecutorResult execute(ExecutorRequest request) throws ExecutorException
      Description copied from interface: Executor
      Invokes the tool application using the provided ExecutorRequest. This method is responsible for executing the command or build process based on the information contained in the request.
      Specified by:
      execute in interface Executor
      Parameters:
      request - the request containing all necessary information for the execution
      Returns:
      ExecutorResult carrying the result of the execution
      Throws:
      ExecutorException - if an error occurs during the execution process
    • mavenVersion

      public String mavenVersion() throws ExecutorException
      Description copied from interface: Executor
      Returns the Maven version that this executor points at (would use). This operation, depending on the underlying implementation, can be costly. If a caller uses this method often, it is the caller's responsibility to properly cache returned values.
      Specified by:
      mavenVersion in interface Executor
      Returns:
      a string representing the Maven version or Executor.UNKNOWN_VERSION
      Throws:
      ExecutorException - if an error occurs during the execution process
    • detectUid

      protected int detectUid(Path userHome) throws IOException
      Throws:
      IOException
    • close

      public void close()
      Description copied from interface: Executor
      Closes and disposes of this Executor instance, releasing any resources it may hold. This method is called automatically when using try-with-resources statements.

      The default implementation does nothing. Subclasses should override this method if they need to perform cleanup operations.

      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Executor
      Overrides:
      close in class ProcessBuilderExecutorSupport