Class JModCreateMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.maven.plugins.jmod.AbstractJModMojo
org.apache.maven.plugins.jmod.JModCreateMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="create", requiresDependencyResolution=COMPILE, defaultPhase=PACKAGE, requiresProject=true) public class JModCreateMojo extends AbstractJModMojo
The create goal is intended to create jmod files which can be used for later linking via maven-jlink-plugin. The jmod files can not be used as usual dependencies on the classpath only in relationship with maven-jlink-plugin.
  • Field Details

    • JMODS

      private static final String JMODS
      See Also:
    • classpathElements

      private List<String> classpathElements
    • modulepathElements

      private List<String> modulepathElements
    • pathElements

      private Map<String,org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor> pathElements
    • compilePath

      @Parameter(defaultValue="${project.compileClasspathElements}", readonly=true, required=true) private List<String> compilePath
    • locationManager

      @Component private org.codehaus.plexus.languages.java.jpms.LocationManager locationManager
    • cmds

      @Parameter private List<String> cmds
      Specifies one or more directories containing native commands to be copied. The given directories are relative to the current base directory. If no entry is defined the default is src/main/cmds used.
       <cmds>
         <cmd>...</cmd>
         <cmd>...</cmd>
         .
         .
       </cmds>
       

      All files from those directories will be copied into the resulting directory bin within the jmod file.

      JMod command line equivalent: --cmds <path>.
    • DEFAULT_CMD_DIRECTORY

      private static final String DEFAULT_CMD_DIRECTORY
      See Also:
    • configs

      @Parameter private List<String> configs
      Specifies one or more directories containing configuration files to be copied. Location of user-editable config files. If no configuration is given the src/main/configs location is used as default. If this directory does not exist the whole will be ignored.
       <configs>
         <config>...</config>
         <config>...</config>
         .
         .
       </configs>
       

      All files from those directories will be copied into the resulting directory config within the jmod file.

      jmod command line equivalent: --config <path>.
    • DEFAULT_CONFIG_DIRECTORY

      private static final String DEFAULT_CONFIG_DIRECTORY
      See Also:
    • excludes

      @Parameter private List<String> excludes
      Exclude files matching the pattern list. Each element using one the following forms: <glob-pattern>, glob:<glob-pattern> or regex:<regex-pattern>
       <excludes>
         <exclude>...</exclude>
         <exclude>...</exclude>
         .
         .
       </excludes>
       
    • mainClass

      @Parameter private String mainClass
      Define the main class which is recorded in the module-info.class file.
    • libs

      @Parameter private List<String> libs
      Specifies one or more directories containing native libraries to be copied (The given directories are relative to project base directory). If no configuration is given in <<pom.xml>> file the location src/main/libs will be used. If the default location does not exist the whole configuration will be ignored.
       <libs>
         <lib>...</lib>
         <lib>...</lib>
         .
         .
       </libs>
       

      All files from those directories will be copied into the resulting directory lib within the jmod file.

    • DEFAULT_LIB_DIRECTORY

      private static final String DEFAULT_LIB_DIRECTORY
      See Also:
    • moduleVersion

      @Parameter(defaultValue="${project.version}") private String moduleVersion
      Define the module version of the jmod file.
    • doNotResolveByDefault

      @Parameter(defaultValue="false") private boolean doNotResolveByDefault
      --do-not-resolve-by-default Exclude from the default root set of modules
    • headerFiles

      @Parameter private List<String> headerFiles
      Define the locations of header files. The default location is src/main/headerfiles. If the the default location does not exist in the current project it will be ignored. The given directories are relative to the project base directory. If an entry is defined the definition of all locations is needed.
       <headerFiles>
         <headerFile>...</headerFile>
         <headerFile>...</headerFile>
         .
         .
       </headerFiles>
       

      All files from those directories will be copied into the resulting directory includes within the jmod file.

      jmod command line equivalent --header-files <path>
    • DEFAULT_HEADER_FILES_DIRECTORY

      private static final String DEFAULT_HEADER_FILES_DIRECTORY
      See Also:
    • manPages

      @Parameter private List<String> manPages
      Define the locations of man pages. The default location is src/main/manpages. The given man pages locations are relative to the project base directory.
       <manPages>
         <manPage>...</manPage>
         <manPage>...</manPage>
         .
         .
       </manPages>
       

      All files from those directories will be copied into the resulting directory man within the jmod file.

      jmod command line equivalent --man-pages <path>
    • DEFAULT_MAN_PAGES_DIRECTORY

      private static final String DEFAULT_MAN_PAGES_DIRECTORY
      See Also:
    • outputFileName

      @Parameter(defaultValue="${project.artifactId}", required=true, readonly=true) private String outputFileName
      This is only the name of the jmod file in the target directory.
    • legalNotices

      @Parameter private List<String> legalNotices
      Define the location of legal notices. The default location is src/main/legalnotices. The given man pages locations are relative to the project base directory.
       <legalNotices>
         <legalNotice>...</legalNotice>
         <legalNotice>...</legalNotice>
         .
         .
       </legalNotices>
       

      All files from those directories will be copied into the resulting directory legal within the jmod file.

      jmod command line equivalent --legal-notices <path>
    • targetPlatform

      @Parameter private String targetPlatform
      --target-platform <target-platform> Target platform TODO: Which values are valid?
    • warnIfResolved

      @Parameter private String warnIfResolved
      Hint for a tool to issue a warning if the module is resolved. The valid values are:
      • deprecated
      • deprecated-for-removal
      • incubating
    • targetClassesDirectory

      @Parameter(defaultValue="${project.build.outputDirectory}", required=true, readonly=true) private File targetClassesDirectory
    • outputDirectory

      @Parameter(defaultValue="${project.build.directory}", required=true, readonly=true) private File outputDirectory
    • modulePaths

      private List<String> modulePaths
  • Constructor Details

    • JModCreateMojo

      public JModCreateMojo()
  • Method Details

    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
      org.apache.maven.plugin.MojoFailureException
    • deleteOutputIfAlreadyExists

      private void deleteOutputIfAlreadyExists(File resultingJModFile) throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • failIfParametersAreNotInTheirValidValueRanges

      private void failIfParametersAreNotInTheirValidValueRanges() throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • throwExceptionIfNotExistOrNotADirectory

      private void throwExceptionIfNotExistOrNotADirectory(List<String> configurations, String partialMessage) throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • getCompileClasspathElements

      private List<File> getCompileClasspathElements(org.apache.maven.project.MavenProject project)
    • preparePaths

      private void preparePaths()
    • createJModCreateCommandLine

      private org.codehaus.plexus.util.cli.Commandline createJModCreateCommandLine(File resultingJModFile) throws IOException
      Throws:
      IOException
    • isConfigurationDefinedInPOM

      private boolean isConfigurationDefinedInPOM(List<String> configuration)
    • handleConfigurationListWithDefault

      private List<String> handleConfigurationListWithDefault(List<String> configuration, String defaultLocation)
    • resolveAgainstProjectBaseDir

      private List<String> resolveAgainstProjectBaseDir(List<String> relativeDirectories)
    • doDefaultsExist

      private boolean doDefaultsExist(String defaultLocation)
    • getPlatformSeparatedList

      private String getPlatformSeparatedList(List<String> paths)
    • writeBoxedWarning

      private void writeBoxedWarning(String message)