Class NativeJavahMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

    public class NativeJavahMojo
    extends AbstractNativeMojo
    Generate JNI include files based on a set of class names
    • Field Detail

      • javahProvider

        private java.lang.String javahProvider
        Javah Provider.
        Since:
        1.0-alpha-2
      • javahClassNames

        private java.util.List javahClassNames
        List of class names to generate native files. Additional JNI interface will automatically discovered from project's dependencies of jar type, when javahSearchJNIFromDependencies is true
        Since:
        1.0-alpha-4
      • javahSearchJNIFromDependencies

        private boolean javahSearchJNIFromDependencies
        Enable the search from project dependencies for JNI interfaces, in addition to javahClassNames
        Since:
        1.0-alpha-4
      • javahPath

        private java.io.File javahPath
        Path to javah executable, if present, it will override the default one which bases on architecture type. See 'javahProvider' argument
        Since:
        1.0-alpha-2
      • javahOutputDirectory

        protected java.io.File javahOutputDirectory
        Where to place javah generated file
        Since:
        1.0-alpha-2
      • javahOutputFileName

        private java.lang.String javahOutputFileName
        if configured, this value will be combined with outputDirectory to pass into javah's -o option
        Since:
        1.0-alpha-4
      • javahIncludes

        private java.util.List javahIncludes
        Additional javah classname and its corresponding header name. Use this option to create one class per header

         <javahIncludes>
           <javahInclude>
             <className>com.some.Class</className>
             <headerName>Class.h</headerName>
           <javahInclude>
         </javahIncludes>
         
        Since:
        1.0-alpha-8
      • javahVerbose

        private boolean javahVerbose
        Enable javah verbose mode
        Since:
        1.0-alpha-2
      • attach

        private boolean attach
        Archive all generated include files and deploy as an inczip
        Since:
        1.0-alpha-8
      • classifier

        private java.lang.String classifier
        Classifier name when install/deploy generated includes file. See ${attach} for details
        Since:
        1.0-alpha-8
      • incZipFile

        private java.io.File incZipFile
        Archive file to bundle all generated include files if enable by ${attach}
        Since:
        1.0-alpha-8
      • manager

        private JavahManager manager
        Internal: To look up javah implementation
        Since:
        1.0-alpha-2
      • projectHelper

        private org.apache.maven.project.MavenProjectHelper projectHelper
        Maven ProjectHelper.
        Since:
        1.0-alpha-8
    • Constructor Detail

      • NativeJavahMojo

        public NativeJavahMojo()
    • Method Detail

      • execute

        public void execute()
                     throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • attachGeneratedIncludeFilesAsIncZip

        private void attachGeneratedIncludeFilesAsIncZip()
                                                  throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • getJavah

        private Javah getJavah()
                        throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • getJavahArtifacts

        private java.util.List getJavahArtifacts()
        Get all jars in the pom excluding transitive, test, and provided scope dependencies.
        Returns:
      • getJavahClassPath

        private java.lang.String[] getJavahClassPath()
        Build classpaths from dependent jars including project output directory (i.e. classes directory )
        Returns:
      • discoverAdditionalJNIClassName

        private void discoverAdditionalJNIClassName()
                                             throws org.apache.maven.plugin.MojoExecutionException
        Get applicable class names to be "javahed"
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • createProviderConfiguration

        private JavahConfiguration createProviderConfiguration​(java.lang.String[] classNames,
                                                               java.lang.String javahOutputFileName)
                                                        throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • getJavahConfiguration

        protected JavahConfiguration getJavahConfiguration()
        Internal only for test harness purpose
        Returns:
      • getProject

        protected org.apache.maven.project.MavenProject getProject()
        Internal for unit test only
        Overrides:
        getProject in class AbstractNativeMojo