Class AbstractGenerateJPacktoolPomMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractToolMojo
net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractTemplateToolMojo
net.agilhard.maven.plugins.jpacktool.mojo.AbstractGenerateJPacktoolPomMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
GenerateJLinkPomMojo, GenerateJPackagePomMojo

public abstract class AbstractGenerateJPacktoolPomMojo
extends net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractTemplateToolMojo
Generate pom for packaging a project using a Bootstrap and a Business Application.
Author:
Bernd Eilers
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractTemplateToolMojo

    net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractTemplateToolMojo.TemplateGenerator
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected boolean addJDKToLimitModules
    Toggle whether to add all modules in the java boot path to the limitModules setting.
    protected java.util.List<java.lang.String> addModules
    Usually this is not necessary, cause this is handled automatically by the given dependencies.
    protected java.lang.String automaticModulesFolderName
    Name of the automatic-modules folder
    protected java.util.List<java.lang.String> bootstrapArguments
    Command line arguments for the bootstrap appplication.
    protected java.lang.String bootstrapArtifactId
    ArtifactId of the Bootstrap Application.
    protected java.lang.String bootstrapBasePath
    The Update4j basePath Setting for the Bootstrap Application.
    protected boolean bootstrapBasePathBelowHomeDir
    Flag if the bootstrapBasePath setting is relativ to ${user.home}
    protected boolean bootstrapBasePathBelowUserDir
    Flag if the bootstrapBasePath setting is relativ to ${user.dir}
    protected java.lang.String bootstrapBaseUri
    The Update4j baseUri Setting for the Bootstrap Application.
    protected java.lang.String bootstrapGroupId
    GroupId of the Bootstrap Application.
    protected java.lang.String bootstrapMainClass
    The main class for the Bootstrap Application.
    protected java.lang.String bootstrapMainModule
    The main module for the Bootstrap Application.
    protected java.lang.String bootstrapVersion
    Version of the Bootstrap Application.
    protected java.util.List<java.lang.String> businessArguments
    Command line arguments for the business application to pass to the main class if no arguments are specified by the launcher.
    protected java.lang.String businessArtifactId
    ArtifactId of the Business Application.
    protected java.lang.String businessBasePath
    The Update4j basePath Setting for the Business Application.
    protected boolean businessBasePathBelowHomeDir
    Flag if the businessBasePath setting is relativ to ${user.home}
    protected boolean businessBasePathBelowUserDir
    Flag if the businessBasePath setting is relativ to ${user.dir}
    protected java.lang.String businessBaseUri
    The Update4j baseUri Setting for the Business Application.
    protected java.lang.String businessGroupId
    GroupId of the Business Application.
    protected java.lang.String businessMainClass
    The main class for the Bootstrap Application.
    protected java.lang.String businessVersion
    Version of the Business Application.
    protected java.lang.String classPathFolderName
    Name of the classpath folder
    protected java.util.List<java.lang.String> jvmArgs
    JVM flags and options to pass to the application.
    protected java.util.List<java.lang.String> limitModules
    Limit the universe of observable modules.
    protected java.util.List<java.lang.String> modulePaths
    Include additional paths on the --module-path option.
    protected java.lang.String modulesFolderName
    Name of the modules folder
    protected java.io.File outputDirectoryBuild
    Directory where the maven pom.xml generated are written to.
    protected java.lang.String projectArtifactId
    ArtifactId of the generated project If not set businessArtifactId appended by "-jpacktool" is being used.
    protected java.lang.String projectGroupId
    GroupId of the generated project.
    protected java.lang.String projectVersion
    Version of the generated project
    protected java.io.File sourceJdkModules
    Set the JDK location to create a Java custom runtime image.
    protected java.lang.String stripConfigName
    replace this with nothing in the name of the config file
    protected java.lang.String templateBootstrap
    The Template for generating the pom for the Bootstrap Application
    protected java.lang.String templateBusiness
    The Template for generating the pom for the Business Application
    protected java.lang.String templateMain
    The template for the generated main pom.xml where the others are submodules to.

    Fields inherited from class net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractTemplateToolMojo

    outputDirectoyTemplates, templateGenerator

    Fields inherited from class net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractToolMojo

    buildDirectory, classpathArtifacts, excludedArtifacts, javaVersion, jdkToolchain, jpacktoolModel, jpacktoolPropertyPrefix, locationManager, mavenProjectHelper, outputDirectoryAutomaticJars, outputDirectoryClasspathJars, outputDirectoryJPacktool, outputDirectoryModules, project, session, shouldSkipReason, skip, systemModules, templateMap, toolchainManager, verbose, zipArchiver

    Fields inherited from interface org.apache.maven.plugin.Mojo

    ROLE
  • Constructor Summary

    Constructors 
    Constructor Description
    AbstractGenerateJPacktoolPomMojo()  
  • Method Summary

    Modifier and Type Method Description
    void executeToolMain()  
    protected void failIfParametersAreNotInTheirValidValueRanges()  
    protected void generatePom​(java.lang.String templateName, java.io.File outputDir)  
    protected void generatePoms()  
    protected abstract void generatePoms​(java.io.File mainDir)  
    abstract java.lang.String getPackagingTool()  
    protected void initDefaults()  
    protected void initJPacktoolModel()  
    protected void initTemplates()  
    protected void writeProperties()  

    Methods inherited from class net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractTemplateToolMojo

    generateFromTemplate, getTemplateGenerator, getTemplateMap, initTemplate, loadResourceFileIntoString

    Methods inherited from class net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractToolMojo

    bytesToHex, checkShouldSkip, createZipArchiveFromDirectory, execute, executeCommand, executeToolFinish, executeToolStart, getArtifactFile, getClasspathArtifacts, getExcludedArtifacts, getFinalName, getJavaVersion, getJdkToolchain, getJpacktoolPropertyPrefix, getLocationManager, getOutputDirectoryAutomaticJars, getOutputDirectoryClasspathJars, getOutputDirectoryJPacktool, getOutputDirectoryModules, getPluginVersion, getProject, getSession, getShouldSkipReason, getSystemModules, getToolchain, getToolchainManager, getToolExecutable, hasClassifier, isVerbose, publishJPacktoolProperties, publishSHA256, setShouldSkipReason

    Methods inherited from class org.apache.maven.plugin.AbstractMojo

    getLog, getPluginContext, setLog, setPluginContext

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • outputDirectoryBuild

      @Parameter(defaultValue="${project.build.directory}/jpacktool/build", required=true, readonly=true) protected java.io.File outputDirectoryBuild
      Directory where the maven pom.xml generated are written to.
    • projectGroupId

      @Parameter(required=false, readonly=false) protected java.lang.String projectGroupId
      GroupId of the generated project. If not set the businessGroupId is being used.
    • projectArtifactId

      @Parameter(required=false, readonly=false) protected java.lang.String projectArtifactId
      ArtifactId of the generated project If not set businessArtifactId appended by "-jpacktool" is being used.
    • projectVersion

      @Parameter(required=false, readonly=false) protected java.lang.String projectVersion
      Version of the generated project
    • businessGroupId

      @Parameter(required=true, readonly=false) protected java.lang.String businessGroupId
      GroupId of the Business Application.
    • businessArtifactId

      @Parameter(required=true, readonly=false) protected java.lang.String businessArtifactId
      ArtifactId of the Business Application.
    • businessVersion

      @Parameter(required=true, readonly=false) protected java.lang.String businessVersion
      Version of the Business Application.
    • bootstrapGroupId

      @Parameter(required=true, readonly=false, defaultValue="net.agilhard.jpacktool") protected java.lang.String bootstrapGroupId
      GroupId of the Bootstrap Application.
    • bootstrapArtifactId

      @Parameter(required=true, readonly=false, defaultValue="jpacktool-utils") protected java.lang.String bootstrapArtifactId
      ArtifactId of the Bootstrap Application.
    • bootstrapVersion

      @Parameter(required=false, readonly=false) protected java.lang.String bootstrapVersion
      Version of the Bootstrap Application.

      If not set this is set to the version of the plugin.

    • businessBasePathBelowUserDir

      @Parameter(defaultValue="true", required=false, readonly=false) protected boolean businessBasePathBelowUserDir
      Flag if the businessBasePath setting is relativ to ${user.dir}
    • businessBasePathBelowHomeDir

      @Parameter(defaultValue="false", required=false, readonly=false) protected boolean businessBasePathBelowHomeDir
      Flag if the businessBasePath setting is relativ to ${user.home}
    • businessBasePath

      @Parameter(required=true, readonly=false) protected java.lang.String businessBasePath
      The Update4j basePath Setting for the Business Application.
    • businessBaseUri

      @Parameter(required=true, readonly=false) protected java.lang.String businessBaseUri
      The Update4j baseUri Setting for the Business Application.
    • bootstrapBasePathBelowUserDir

      @Parameter(defaultValue="true", required=false, readonly=false) protected boolean bootstrapBasePathBelowUserDir
      Flag if the bootstrapBasePath setting is relativ to ${user.dir}
    • bootstrapBasePathBelowHomeDir

      @Parameter(defaultValue="false", required=false, readonly=false) protected boolean bootstrapBasePathBelowHomeDir
      Flag if the bootstrapBasePath setting is relativ to ${user.home}
    • bootstrapBasePath

      @Parameter(required=false, readonly=false) protected java.lang.String bootstrapBasePath
      The Update4j basePath Setting for the Bootstrap Application.
    • bootstrapBaseUri

      @Parameter(required=false, readonly=false) protected java.lang.String bootstrapBaseUri
      The Update4j baseUri Setting for the Bootstrap Application.
    • bootstrapMainClass

      @Parameter(required=true, readonly=false, defaultValue="net.agilhard.jpacktool.util.update4j.JPacktoolBootstrap") protected java.lang.String bootstrapMainClass
      The main class for the Bootstrap Application.
    • bootstrapMainModule

      @Parameter(required=false, readonly=false) protected java.lang.String bootstrapMainModule
      The main module for the Bootstrap Application.
    • businessMainClass

      @Parameter(required=false, readonly=false) protected java.lang.String businessMainClass
      The main class for the Bootstrap Application.
    • stripConfigName

      @Parameter(required=false, readonly=false, defaultValue="-jpacktool") protected java.lang.String stripConfigName
      replace this with nothing in the name of the config file
    • templateMain

      @Parameter(required=false, readonly=false, defaultValue="resource:/templates/pom/main-jpacktool/pom.xml") protected java.lang.String templateMain
      The template for the generated main pom.xml where the others are submodules to.
    • templateBootstrap

      @Parameter(required=false, readonly=false, defaultValue="resource:/templates/pom/main-jpacktool/bootstrap/pom.xml") protected java.lang.String templateBootstrap
      The Template for generating the pom for the Bootstrap Application
    • templateBusiness

      @Parameter(required=false, readonly=false, defaultValue="resource:/templates/pom/main-jpacktool/business/pom.xml") protected java.lang.String templateBusiness
      The Template for generating the pom for the Business Application
    • jvmArgs

      @Parameter(required=false, readonly=false) protected java.util.List<java.lang.String> jvmArgs
      JVM flags and options to pass to the application.

      --jvm-args <args>

    • bootstrapArguments

      @Parameter(required=false, readonly=false) protected java.util.List<java.lang.String> bootstrapArguments
      Command line arguments for the bootstrap appplication.

      --arguments <args>

    • businessArguments

      @Parameter(required=false, readonly=false) protected java.util.List<java.lang.String> businessArguments
      Command line arguments for the business application to pass to the main class if no arguments are specified by the launcher.

      This sets properties in the update4j config to be picked up by the launcher.

    • sourceJdkModules

      @Parameter protected java.io.File sourceJdkModules
      Set the JDK location to create a Java custom runtime image.
    • modulePaths

      @Parameter protected java.util.List<java.lang.String> modulePaths
      Include additional paths on the --module-path option. Project dependencies and JDK modules are automatically added.
    • limitModules

      @Parameter protected java.util.List<java.lang.String> limitModules
      Limit the universe of observable modules. The following gives an example of the configuration which can be used in the pom.xml file.
         <limitModules>
           <limitModule>mod1</limitModule>
           <limitModule>xyz</limitModule>
           .
           .
         </limitModules>
       

      This configuration is the equivalent of the command line option: --limit-modules <mod>[,<mod>...]

    • addJDKToLimitModules

      @Parameter(defaultValue="false") protected boolean addJDKToLimitModules
      Toggle whether to add all modules in the java boot path to the limitModules setting.
    • addModules

      @Parameter protected java.util.List<java.lang.String> addModules

      Usually this is not necessary, cause this is handled automatically by the given dependencies.

      By using the --add-modules you can define the root modules to be resolved. The configuration in pom.xml file can look like this:

       <addModules>
         <addModule>mod1</addModule>
         <addModule>first</addModule>
         .
         .
       </addModules>
       

      The command line equivalent for jlink is: --add-modules <mod>[,<mod>...].

    • classPathFolderName

      @Parameter(defaultValue="jar") protected java.lang.String classPathFolderName
      Name of the classpath folder
    • automaticModulesFolderName

      @Parameter(defaultValue="autojar") protected java.lang.String automaticModulesFolderName
      Name of the automatic-modules folder
    • modulesFolderName

      @Parameter(defaultValue="jmods") protected java.lang.String modulesFolderName
      Name of the modules folder
  • Constructor Details

  • Method Details

    • getPackagingTool

      public abstract java.lang.String getPackagingTool()
    • executeToolMain

      public void executeToolMain() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Specified by:
      executeToolMain in class net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractToolMojo
      Throws:
      org.apache.maven.plugin.MojoExecutionException
      org.apache.maven.plugin.MojoFailureException
    • failIfParametersAreNotInTheirValidValueRanges

      protected void failIfParametersAreNotInTheirValidValueRanges() throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • initDefaults

      protected void initDefaults() throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • writeProperties

      protected void writeProperties() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • initJPacktoolModel

      protected void initJPacktoolModel() throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • initTemplates

      protected void initTemplates() throws org.apache.maven.plugin.MojoFailureException
      Overrides:
      initTemplates in class net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractTemplateToolMojo
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • generatePoms

      protected abstract void generatePoms​(java.io.File mainDir) throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • generatePoms

      protected void generatePoms() throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • generatePom

      protected void generatePom​(java.lang.String templateName, java.io.File outputDir) throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException