Package io.helidon.inject.maven.plugin
Class AbstractCreatorMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
io.helidon.inject.maven.plugin.AbstractCreatorMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
AbstractApplicationCreatorMojo
,ExternalModuleCreatorMojo
public abstract class AbstractCreatorMojo
extends org.apache.maven.plugin.AbstractMojo
Abstract base for all creator mojo's.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String
The file name written to ./target/inject/ to track the last package name generated for this application.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected String
determinePackageName
(Optional<ServiceProvider<ModuleComponent>> optModuleSp, Collection<TypeName> typeNames, io.helidon.inject.tools.ModuleInfoDescriptor descriptor, boolean persistIt) Determines the primary package name (which also typically doubles as the application name).void
execute()
protected File
The scratch directory.protected String
The target package name.protected File
The project build directory.protected abstract void
Gated/controlled by theTrafficCop
.protected boolean
Returns true if debug is enabled.Attempts to load the app package name from what was previously recorded.protected void
saveAppPackageName
(String packageName) Persist the package name into scratch for later usage.Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
APPLICATION_PACKAGE_FILE_NAME
The file name written to ./target/inject/ to track the last package name generated for this application. This application package name is what we fall back to for the application name and the module name if not otherwise specified directly.- See Also:
-
-
Constructor Details
-
AbstractCreatorMojo
protected AbstractCreatorMojo()Default constructor.
-
-
Method Details
-
isDebugEnabled
protected boolean isDebugEnabled()Returns true if debug is enabled.- Returns:
- true if in debug mode
-
getProjectBuildTargetDir
The project build directory.- Returns:
- the project build directory
-
getInjectScratchDir
The scratch directory.- Returns:
- the scratch directory
-
getPackageName
The target package name.- Returns:
- the target package name
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
determinePackageName
protected String determinePackageName(Optional<ServiceProvider<ModuleComponent>> optModuleSp, Collection<TypeName> typeNames, io.helidon.inject.tools.ModuleInfoDescriptor descriptor, boolean persistIt) Determines the primary package name (which also typically doubles as the application name).- Parameters:
optModuleSp
- the module service providertypeNames
- the type namesdescriptor
- the descriptorpersistIt
- pass true to write it to scratch, so that we can use it in the future for this module- Returns:
- the package name (which also typically doubles as the application name)
-
loadAppPackageName
Attempts to load the app package name from what was previously recorded.- Returns:
- the app package name that was loaded
-
saveAppPackageName
Persist the package name into scratch for later usage.- Parameters:
packageName
- the package name
-
innerExecute
protected abstract void innerExecute() throws org.apache.maven.plugin.MojoExecutionExceptionGated/controlled by theTrafficCop
.- Throws:
org.apache.maven.plugin.MojoExecutionException
- if any mojo problems occur
-