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,ShellInvoker,UpgradeInvoker
Lookup invoker implementation, that boots up DI container.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidactivateLogging(C context) protected intcalculateDegreeOfConcurrency(String threadConfiguration) protected voidconfigureLogging(C context) protected voidprotected ContainerCapsuleFactory<C> protected abstract CcreateContext(InvokerRequest invokerRequest) protected CoreExtensionSelector<C> protected final voidcreateTerminal(C context) protected voidcustomizeSettingsRequest(C context, SettingsBuilderRequest settingsBuilderRequest) protected voidcustomizeSettingsResult(C context, SettingsBuilderResult settingsBuilderResult) protected Stringdescribe(org.jline.terminal.Terminal terminal) protected BuildEventListenerdetermineBuildEventListener(C context) determineWriter(C context) protected final voiddoConfigureWithTerminal(C context, org.jline.terminal.Terminal terminal) Called fromcreateTerminal(LookupContext)when Terminal was built.protected voidOverride this method to add some special handling for "raw streams" disabled option.protected voidOverride this method to add some special handling for "raw streams" enabled option.protected voiddoCreateTerminal(C context, org.jline.terminal.TerminalBuilder builder) Override this method to create Terminal as you want.protected BuildEventListenerdoDetermineBuildEventListener(C context) doDetermineWriter(C context) protected intprotected abstract intprotected InvokerException.ExitExceptionhandleException(C context, Exception e) protected voidhelpOrVersionAndMayExit(C context) protected voidfinal intinvoke(InvokerRequest invokerRequest) Invokes the Maven application using the providedInvokerRequest.protected PathlocalRepositoryPath(C context) protected voidprotected booleanmayDisableInteractiveMode(C context, boolean proposedInteractive) protected voidpopulateRequest(C context, Lookup lookup, MavenExecutionRequest request) protected voidpopulateRequestFromSettings(MavenExecutionRequest request, Settings settings) protected voidpostCommands(C context) protected voidpostContainer(C context) protected voidpreCommands(C context) protected voidprintErrors(C context, boolean showStackTrace, List<Logger.Entry> entries, Logger logger) protected voidpushCoreProperties(C context) protected voidpushUserProperties(C context) Note: this method is called twice fromdoInvoke(LookupContext)and modifies context.protected voidprotected Runnablesettings(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 voidshowVersion(C context) protected void
-
Field Details
-
protoLookup
-
contextConsumer
-
-
Constructor Details
-
LookupInvoker
-
-
Method Details
-
invoke
Description copied from interface:InvokerInvokes 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. -
doInvoke
-
handleException
-
printErrors
protected void printErrors(C context, boolean showStackTrace, List<Logger.Entry> entries, Logger logger) -
createContext
-
validate
-
pushCoreProperties
-
pushUserProperties
Note: this method is called twice fromdoInvoke(LookupContext)and modifies context. First invocation whenLookupContext.pushedUserPropertiesis 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 AFTERPropertyContributorSPI invocation, and "refreshes" already pushed user properties by re-writing them as SPI may have modified them.- Throws:
Exception
-
configureLogging
-
determineBuildEventListener
-
doDetermineBuildEventListener
-
createTerminal
-
doCreateTerminal
Override this method to create Terminal as you want.- See Also:
-
doConfigureWithTerminal
Called fromcreateTerminal(LookupContext)when Terminal was built. -
doConfigureWithTerminalWithRawStreamsEnabled
Override this method to add some special handling for "raw streams" enabled option. -
doConfigureWithTerminalWithRawStreamsDisabled
Override this method to add some special handling for "raw streams" disabled option. -
determineWriter
-
doDetermineWriter
-
activateLogging
-
helpOrVersionAndMayExit
-
showVersion
-
describe
-
preCommands
-
container
-
createCoreExtensionSelector
-
createContainerCapsuleFactory
-
postContainer
-
lookup
-
init
-
postCommands
-
settings
-
settings
protected Runnable 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.
The method returns a "cleaner" runnable, as during extension loading the context needs to be "cleaned", restored to previous state (as it was before extension loading).
- 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
-
execute
-