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 Details

    • APPLICATION_PACKAGE_FILE_NAME

      protected static final String 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

      protected File getProjectBuildTargetDir()
      The project build directory.
      Returns:
      the project build directory
    • getInjectScratchDir

      protected File getInjectScratchDir()
      The scratch directory.
      Returns:
      the scratch directory
    • getPackageName

      protected String 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 provider
      typeNames - the type names
      descriptor - the descriptor
      persistIt - 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

      protected Optional<String> loadAppPackageName()
      Attempts to load the app package name from what was previously recorded.
      Returns:
      the app package name that was loaded
    • saveAppPackageName

      protected void saveAppPackageName(String packageName)
      Persist the package name into scratch for later usage.
      Parameters:
      packageName - the package name
    • innerExecute

      protected abstract void innerExecute() throws org.apache.maven.plugin.MojoExecutionException
      Gated/controlled by the TrafficCop.
      Throws:
      org.apache.maven.plugin.MojoExecutionException - if any mojo problems occur