Package org.apache.maven.cling.invoker
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
Lookup invoker implementation, that boots up DI container.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
activateLogging
(C context) protected int
calculateDegreeOfConcurrency
(String threadConfiguration) protected void
configureLogging
(C context) protected void
protected ContainerCapsuleFactory<C>
protected abstract C
createContext
(InvokerRequest invokerRequest) protected void
createTerminal
(C context) protected void
customizeSettingsRequest
(C context, SettingsBuilderRequest settingsBuilderRequest) protected void
customizeSettingsResult
(C context, SettingsBuilderResult settingsBuilderResult) protected String
describe
(org.jline.terminal.Terminal terminal) protected BuildEventListener
determineBuildEventListener
(C context) determineWriter
(C context) protected void
doConfigureWithTerminal
(C context, org.jline.terminal.Terminal terminal) protected BuildEventListener
doDetermineBuildEventListener
(C context) doDetermineWriter
(C context) protected int
protected abstract int
protected InvokerException
handleException
(C context, Exception e) protected void
helpOrVersionAndMayExit
(C context) protected void
int
invoke
(InvokerRequest invokerRequest) Invokes the Maven application using the providedInvokerRequest
.protected boolean
isRunningOnCI
(C context) protected Path
localRepositoryPath
(C context) protected void
protected boolean
mayDisableInteractiveMode
(C context, boolean proposedInteractive) protected void
populateRequest
(C context, Lookup lookup, MavenExecutionRequest request) protected void
populateRequestFromSettings
(MavenExecutionRequest request, Settings settings) protected void
postCommands
(C context) protected void
postContainer
(C context) protected void
preCommands
(C context) protected void
protected void
pushCoreProperties
(C context) protected void
pushUserProperties
(C context) Note: this method is called twice fromdoInvoke(LookupContext)
and modifies context.protected void
protected void
settings
(C context, boolean emitSettingsWarnings, SettingsBuilder settingsBuilder) 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.protected void
showVersion
(C context) protected void
-
Field Details
-
protoLookup
-
-
Constructor Details
-
LookupInvoker
-
-
Method Details
-
invoke
Description copied from interface:Invoker
Invokes the Maven application using the providedInvokerRequest
. This method is responsible for executing the Maven command or build process based on the information contained in the request.- Specified by:
invoke
in interfaceInvoker
- 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
- Throws:
Exception
-
handleException
- Throws:
InvokerException
-
createContext
- Throws:
InvokerException
-
pushCoreProperties
- Throws:
Exception
-
pushUserProperties
Note: this method is called twice fromdoInvoke(LookupContext)
and modifies context. First invocation whenLookupContext.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 AFTERPropertyContributor
SPI invocation, and "refreshes" already pushed user properties by re-writing them as SPI may have modified them.- Throws:
Exception
-
validate
- Throws:
Exception
-
prepare
- Throws:
Exception
-
configureLogging
- Throws:
Exception
-
determineBuildEventListener
-
doDetermineBuildEventListener
-
createTerminal
-
doConfigureWithTerminal
-
determineWriter
-
doDetermineWriter
-
activateLogging
- Throws:
Exception
-
helpOrVersionAndMayExit
- Throws:
Exception
-
showVersion
-
describe
-
preCommands
- Throws:
Exception
-
container
- Throws:
Exception
-
createContainerCapsuleFactory
-
postContainer
- Throws:
Exception
-
lookup
- Throws:
Exception
-
init
- Throws:
Exception
-
postCommands
- Throws:
Exception
-
settings
- 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
-
localRepositoryPath
-
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
-
isRunningOnCI
-
execute
- Throws:
Exception
-