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
-
Field Summary
Fields Modifier and Type Field Description protected booleanaddJDKToLimitModulesToggle whether to add all modules in the java boot path to the limitModules setting.protected java.util.List<java.lang.String>addModulesUsually this is not necessary, cause this is handled automatically by the given dependencies.protected java.lang.StringautomaticModulesFolderNameName of the automatic-modules folderprotected java.util.List<java.lang.String>bootstrapArgumentsCommand line arguments for the bootstrap appplication.protected java.lang.StringbootstrapArtifactIdArtifactId of the Bootstrap Application.protected java.lang.StringbootstrapBasePathThe Update4j basePath Setting for the Bootstrap Application.protected booleanbootstrapBasePathBelowHomeDirFlag if the bootstrapBasePath setting is relativ to ${user.home}protected booleanbootstrapBasePathBelowUserDirFlag if the bootstrapBasePath setting is relativ to ${user.dir}protected java.lang.StringbootstrapBaseUriThe Update4j baseUri Setting for the Bootstrap Application.protected java.lang.StringbootstrapGroupIdGroupId of the Bootstrap Application.protected java.lang.StringbootstrapMainClassThe main class for the Bootstrap Application.protected java.lang.StringbootstrapMainModuleThe main module for the Bootstrap Application.protected java.lang.StringbootstrapVersionVersion of the Bootstrap Application.protected java.util.List<java.lang.String>businessArgumentsCommand line arguments for the business application to pass to the main class if no arguments are specified by the launcher.protected java.lang.StringbusinessArtifactIdArtifactId of the Business Application.protected java.lang.StringbusinessBasePathThe Update4j basePath Setting for the Business Application.protected booleanbusinessBasePathBelowHomeDirFlag if the businessBasePath setting is relativ to ${user.home}protected booleanbusinessBasePathBelowUserDirFlag if the businessBasePath setting is relativ to ${user.dir}protected java.lang.StringbusinessBaseUriThe Update4j baseUri Setting for the Business Application.protected java.lang.StringbusinessGroupIdGroupId of the Business Application.protected java.lang.StringbusinessMainClassThe main class for the Bootstrap Application.protected java.lang.StringbusinessVersionVersion of the Business Application.protected java.lang.StringclassPathFolderNameName of the classpath folderprotected java.util.List<java.lang.String>jvmArgsJVM flags and options to pass to the application.protected java.util.List<java.lang.String>limitModulesLimit the universe of observable modules.protected java.util.List<java.lang.String>modulePathsInclude additional paths on the--module-pathoption.protected java.lang.StringmodulesFolderNameName of the modules folderprotected java.io.FileoutputDirectoryBuildDirectory where the maven pom.xml generated are written to.protected java.lang.StringprojectArtifactIdArtifactId of the generated project If not set businessArtifactId appended by "-jpacktool" is being used.protected java.lang.StringprojectGroupIdGroupId of the generated project.protected java.lang.StringprojectVersionVersion of the generated projectprotected java.io.FilesourceJdkModulesSet the JDK location to create a Java custom runtime image.protected java.lang.StringstripConfigNamereplace this with nothing in the name of the config fileprotected java.lang.StringtemplateBootstrapThe Template for generating the pom for the Bootstrap Applicationprotected java.lang.StringtemplateBusinessThe Template for generating the pom for the Business Applicationprotected java.lang.StringtemplateMainThe 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, templateGeneratorFields 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 -
Constructor Summary
Constructors Constructor Description AbstractGenerateJPacktoolPomMojo() -
Method Summary
Modifier and Type Method Description voidexecuteToolMain()protected voidfailIfParametersAreNotInTheirValidValueRanges()protected voidgeneratePom(java.lang.String templateName, java.io.File outputDir)protected voidgeneratePoms()protected abstract voidgeneratePoms(java.io.File mainDir)abstract java.lang.StringgetPackagingTool()protected voidinitDefaults()protected voidinitJPacktoolModel()protected voidinitTemplates()protected voidwriteProperties()Methods inherited from class net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractTemplateToolMojo
generateFromTemplate, getTemplateGenerator, getTemplateMap, initTemplate, loadResourceFileIntoStringMethods 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
-
Field Details
-
outputDirectoryBuild
@Parameter(defaultValue="${project.build.directory}/jpacktool/build", required=true, readonly=true) protected java.io.File outputDirectoryBuildDirectory where the maven pom.xml generated are written to. -
projectGroupId
@Parameter(required=false, readonly=false) protected java.lang.String projectGroupIdGroupId of the generated project. If not set the businessGroupId is being used. -
projectArtifactId
@Parameter(required=false, readonly=false) protected java.lang.String projectArtifactIdArtifactId of the generated project If not set businessArtifactId appended by "-jpacktool" is being used. -
projectVersion
@Parameter(required=false, readonly=false) protected java.lang.String projectVersionVersion of the generated project -
businessGroupId
@Parameter(required=true, readonly=false) protected java.lang.String businessGroupIdGroupId of the Business Application. -
businessArtifactId
@Parameter(required=true, readonly=false) protected java.lang.String businessArtifactIdArtifactId of the Business Application. -
businessVersion
@Parameter(required=true, readonly=false) protected java.lang.String businessVersionVersion of the Business Application. -
bootstrapGroupId
@Parameter(required=true, readonly=false, defaultValue="net.agilhard.jpacktool") protected java.lang.String bootstrapGroupIdGroupId of the Bootstrap Application. -
bootstrapArtifactId
@Parameter(required=true, readonly=false, defaultValue="jpacktool-utils") protected java.lang.String bootstrapArtifactIdArtifactId of the Bootstrap Application. -
bootstrapVersion
@Parameter(required=false, readonly=false) protected java.lang.String bootstrapVersionVersion 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 businessBasePathBelowUserDirFlag if the businessBasePath setting is relativ to ${user.dir} -
businessBasePathBelowHomeDir
@Parameter(defaultValue="false", required=false, readonly=false) protected boolean businessBasePathBelowHomeDirFlag if the businessBasePath setting is relativ to ${user.home} -
businessBasePath
@Parameter(required=true, readonly=false) protected java.lang.String businessBasePathThe Update4j basePath Setting for the Business Application. -
businessBaseUri
@Parameter(required=true, readonly=false) protected java.lang.String businessBaseUriThe Update4j baseUri Setting for the Business Application. -
bootstrapBasePathBelowUserDir
@Parameter(defaultValue="true", required=false, readonly=false) protected boolean bootstrapBasePathBelowUserDirFlag if the bootstrapBasePath setting is relativ to ${user.dir} -
bootstrapBasePathBelowHomeDir
@Parameter(defaultValue="false", required=false, readonly=false) protected boolean bootstrapBasePathBelowHomeDirFlag if the bootstrapBasePath setting is relativ to ${user.home} -
bootstrapBasePath
@Parameter(required=false, readonly=false) protected java.lang.String bootstrapBasePathThe Update4j basePath Setting for the Bootstrap Application. -
bootstrapBaseUri
@Parameter(required=false, readonly=false) protected java.lang.String bootstrapBaseUriThe Update4j baseUri Setting for the Bootstrap Application. -
bootstrapMainClass
@Parameter(required=true, readonly=false, defaultValue="net.agilhard.jpacktool.util.update4j.JPacktoolBootstrap") protected java.lang.String bootstrapMainClassThe main class for the Bootstrap Application. -
bootstrapMainModule
@Parameter(required=false, readonly=false) protected java.lang.String bootstrapMainModuleThe main module for the Bootstrap Application. -
businessMainClass
@Parameter(required=false, readonly=false) protected java.lang.String businessMainClassThe main class for the Bootstrap Application. -
stripConfigName
@Parameter(required=false, readonly=false, defaultValue="-jpacktool") protected java.lang.String stripConfigNamereplace 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 templateMainThe 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 templateBootstrapThe 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 templateBusinessThe Template for generating the pom for the Business Application -
jvmArgs
@Parameter(required=false, readonly=false) protected java.util.List<java.lang.String> jvmArgsJVM flags and options to pass to the application.--jvm-args <args> -
bootstrapArguments
@Parameter(required=false, readonly=false) protected java.util.List<java.lang.String> bootstrapArgumentsCommand line arguments for the bootstrap appplication.--arguments <args> -
businessArguments
@Parameter(required=false, readonly=false) protected java.util.List<java.lang.String> businessArgumentsCommand 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 sourceJdkModulesSet the JDK location to create a Java custom runtime image. -
modulePaths
@Parameter protected java.util.List<java.lang.String> modulePathsInclude additional paths on the--module-pathoption. Project dependencies and JDK modules are automatically added. -
limitModules
@Parameter protected java.util.List<java.lang.String> limitModulesLimit the universe of observable modules. The following gives an example of the configuration which can be used in thepom.xmlfile.<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 addJDKToLimitModulesToggle whether to add all modules in the java boot path to the limitModules setting. -
addModules
@Parameter protected java.util.List<java.lang.String> addModulesUsually 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.xmlfile 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 classPathFolderNameName of the classpath folder -
automaticModulesFolderName
@Parameter(defaultValue="autojar") protected java.lang.String automaticModulesFolderNameName of the automatic-modules folder -
modulesFolderName
@Parameter(defaultValue="jmods") protected java.lang.String modulesFolderNameName of the modules folder
-
-
Constructor Details
-
AbstractGenerateJPacktoolPomMojo
public AbstractGenerateJPacktoolPomMojo()
-
-
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:
executeToolMainin classnet.agilhard.maven.plugins.jpacktool.base.mojo.AbstractToolMojo- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.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:
initTemplatesin classnet.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
-