Class 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 Detail

      • classpathElements

        private java.util.List<java.lang.String> classpathElements
      • modulepathElements

        private java.util.List<java.lang.String> modulepathElements
      • pathElements

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

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

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

        @Parameter
        private java.util.List<java.lang.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 java.lang.String DEFAULT_CMD_DIRECTORY
        See Also:
        Constant Field Values
      • configs

        @Parameter
        private java.util.List<java.lang.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 java.lang.String DEFAULT_CONFIG_DIRECTORY
        See Also:
        Constant Field Values
      • excludes

        @Parameter
        private java.util.List<java.lang.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 java.lang.String mainClass
        Define the main class which is recorded in the module-info.class file.
      • libs

        @Parameter
        private java.util.List<java.lang.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 <> 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 java.lang.String DEFAULT_LIB_DIRECTORY
        See Also:
        Constant Field Values
      • moduleVersion

        @Parameter(defaultValue="${project.version}")
        private java.lang.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 java.util.List<java.lang.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 java.lang.String DEFAULT_HEADER_FILES_DIRECTORY
        See Also:
        Constant Field Values
      • manPages

        @Parameter
        private java.util.List<java.lang.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 java.lang.String DEFAULT_MAN_PAGES_DIRECTORY
        See Also:
        Constant Field Values
      • outputFileName

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

        @Parameter
        private java.util.List<java.lang.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>
      • DEFAULT_LEGAL_NOTICES_DIRECTORY

        private static final java.lang.String DEFAULT_LEGAL_NOTICES_DIRECTORY
        See Also:
        Constant Field Values
      • targetPlatform

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

        @Parameter
        private java.lang.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 java.io.File targetClassesDirectory
      • outputDirectory

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

        private java.util.List<java.lang.String> modulePaths
    • Constructor Detail

      • JModCreateMojo

        public JModCreateMojo()
    • Method Detail

      • 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​(java.io.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​(java.util.List<java.lang.String> configurations,
                                                             java.lang.String partialMessage)
                                                      throws org.apache.maven.plugin.MojoFailureException
        Throws:
        org.apache.maven.plugin.MojoFailureException
      • getCompileClasspathElements

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

        private void preparePaths()
      • createJModCreateCommandLine

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

        private boolean isConfigurationDefinedInPOM​(java.util.List<java.lang.String> configuration)
      • handleConfigurationListWithDefault

        private java.util.List<java.lang.String> handleConfigurationListWithDefault​(java.util.List<java.lang.String> configuration,
                                                                                    java.lang.String defaultLocation)
      • resolveAgainstProjectBaseDir

        private java.util.List<java.lang.String> resolveAgainstProjectBaseDir​(java.util.List<java.lang.String> relativeDirectories)
      • doDefaultsExist

        private boolean doDefaultsExist​(java.lang.String defaultLocation)
      • getPlatformSeparatedList

        private java.lang.String getPlatformSeparatedList​(java.util.List<java.lang.String> paths)
      • writeBoxedWarning

        private void writeBoxedWarning​(java.lang.String message)