Class LookupInvoker<C extends LookupContext>

java.lang.Object
org.apache.maven.cling.invoker.LookupInvoker<C>
Type Parameters:
C - The context type.
All Implemented Interfaces:
AutoCloseable, Invoker
Direct Known Subclasses:
EncryptInvoker, MavenInvoker

public abstract class LookupInvoker<C extends LookupContext> extends Object implements Invoker
Lookup invoker implementation, that boots up DI container.
  • Field Details

    • protoLookup

      protected final ProtoLookup protoLookup
  • Constructor Details

    • LookupInvoker

      public LookupInvoker(ProtoLookup protoLookup)
  • Method Details

    • invoke

      public int invoke(InvokerRequest invokerRequest) throws InvokerException
      Description copied from interface: Invoker
      Invokes the Maven application using the provided InvokerRequest. This method is responsible for executing the Maven command or build process based on the information contained in the request.
      Specified by:
      invoke in interface Invoker
      Parameters:
      invokerRequest - the request containing all necessary information for the invocation
      Returns:
      an integer representing the exit code of the invocation (0 typically indicates success)
      Throws:
      InvokerException - if an error occurs during the invocation process
    • doInvoke

      protected int doInvoke(C context) throws Exception
      Throws:
      Exception
    • handleException

      protected InvokerException handleException(C context, Exception e) throws InvokerException
      Throws:
      InvokerException
    • createContext

      protected abstract C createContext(InvokerRequest invokerRequest) throws InvokerException
      Throws:
      InvokerException
    • pushCoreProperties

      protected void pushCoreProperties(C context) throws Exception
      Throws:
      Exception
    • pushUserProperties

      protected void pushUserProperties(C context) throws Exception
      Note: this method is called twice from doInvoke(LookupContext) and modifies context. First invocation when LookupContext.pushedUserProperties is null will push user properties IF key does not already exist among Java System Properties, and collects all they key it pushes. Second invocation happens AFTER PropertyContributor SPI invocation, and "refreshes" already pushed user properties by re-writing them as SPI may have modified them.
      Throws:
      Exception
    • validate

      protected void validate(C context) throws Exception
      Throws:
      Exception
    • prepare

      protected void prepare(C context) throws Exception
      Throws:
      Exception
    • configureLogging

      protected void configureLogging(C context) throws Exception
      Throws:
      Exception
    • determineBuildEventListener

      protected BuildEventListener determineBuildEventListener(C context)
    • doDetermineBuildEventListener

      protected BuildEventListener doDetermineBuildEventListener(C context)
    • createTerminal

      protected void createTerminal(C context)
    • doConfigureWithTerminal

      protected void doConfigureWithTerminal(C context, org.jline.terminal.Terminal terminal)
    • determineWriter

      protected Consumer<String> determineWriter(C context)
    • doDetermineWriter

      protected Consumer<String> doDetermineWriter(C context)
    • activateLogging

      protected void activateLogging(C context) throws Exception
      Throws:
      Exception
    • helpOrVersionAndMayExit

      protected void helpOrVersionAndMayExit(C context) throws Exception
      Throws:
      Exception
    • showVersion

      protected void showVersion(C context)
    • describe

      protected String describe(org.jline.terminal.Terminal terminal)
    • preCommands

      protected void preCommands(C context) throws Exception
      Throws:
      Exception
    • container

      protected void container(C context) throws Exception
      Throws:
      Exception
    • createContainerCapsuleFactory

      protected ContainerCapsuleFactory<C> createContainerCapsuleFactory()
    • postContainer

      protected void postContainer(C context) throws Exception
      Throws:
      Exception
    • lookup

      protected void lookup(C context) throws Exception
      Throws:
      Exception
    • init

      protected void init(C context) throws Exception
      Throws:
      Exception
    • postCommands

      protected void postCommands(C context) throws Exception
      Throws:
      Exception
    • settings

      protected void settings(C context) throws Exception
      Throws:
      Exception
    • settings

      protected void settings(C context, boolean emitSettingsWarnings, SettingsBuilder settingsBuilder) throws Exception
      This method is invoked twice during "normal" LookupInvoker level startup: once when (if present) extensions are loaded up during Plexus DI creation, and once afterward as "normal" boot procedure.

      If there are Maven3 passwords presents in settings, this results in doubled warnings emitted. So Plexus DI creation call keeps "emitSettingsWarnings" false. If there are fatal issues, it will anyway "die" at that spot before warnings would be emitted.

      Throws:
      Exception
    • customizeSettingsRequest

      protected void customizeSettingsRequest(C context, SettingsBuilderRequest settingsBuilderRequest) throws Exception
      Throws:
      Exception
    • customizeSettingsResult

      protected void customizeSettingsResult(C context, SettingsBuilderResult settingsBuilderResult) throws Exception
      Throws:
      Exception
    • mayDisableInteractiveMode

      protected boolean mayDisableInteractiveMode(C context, boolean proposedInteractive)
    • localRepositoryPath

      protected Path localRepositoryPath(C context)
    • populateRequest

      protected void populateRequest(C context, Lookup lookup, MavenExecutionRequest request) throws Exception
      Throws:
      Exception
    • populateRequestFromSettings

      protected void populateRequestFromSettings(MavenExecutionRequest request, Settings settings) throws Exception
      Throws:
      Exception
    • calculateDegreeOfConcurrency

      protected int calculateDegreeOfConcurrency(String threadConfiguration)
    • isRunningOnCI

      protected boolean isRunningOnCI(C context)
    • execute

      protected abstract int execute(C context) throws Exception
      Throws:
      Exception