Package org.codehaus.mojo.natives.plugin
Class NativeJavahMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.codehaus.mojo.natives.plugin.AbstractNativeMojo
-
- org.codehaus.mojo.natives.plugin.NativeJavahMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
@Mojo(name="javah", defaultPhase=GENERATE_SOURCES, requiresDependencyResolution=COMPILE) public class NativeJavahMojo extends AbstractNativeMojo
Generate JNI include files based on a set of class names
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
attach
Archive all generated include files and deploy as an inczipprivate java.lang.String
classifier
Classifier name when install/deploy generated includes file.private JavahConfiguration
config
For unit test onlyprivate java.io.File
incZipFile
Archive file to bundle all generated include files if enable by ${attach}private java.util.List<java.lang.String>
javahClassNames
List of class names to generate native files.private java.util.List<JavahInclude>
javahIncludes
Additional javah classname and its corresponding header name.protected java.io.File
javahOutputDirectory
Where to place javah generated fileprivate java.lang.String
javahOutputFileName
if configured, this value will be combined with outputDirectory to pass into javah's -o optionprivate java.io.File
javahPath
Path to javah executable, if present, it will override the default one which bases on architecture type.private java.lang.String
javahProvider
Javah Provider.private boolean
javahSearchJNIFromDependencies
Enable the search from project dependencies for JNI interfaces, in addition to javahClassNamesprivate boolean
javahVerbose
Enable javah verbose modeprivate JavahManager
manager
Internal: To look up javah implementationprivate org.apache.maven.project.MavenProjectHelper
projectHelper
Maven ProjectHelper.private boolean
useEnvClasspath
Set CLASSPATH env variable instead of using -classpath command-line argument.-
Fields inherited from class org.codehaus.mojo.natives.plugin.AbstractNativeMojo
dependencyIncludeDirectory, EMPTY_FILE_LIST, envFactoryManager, INCZIP_FOUND, INCZIP_TYPE, LINKER_INPUT_LIST_NAME, LINKER_OUTPUT_PATH, project, workingDirectory
-
-
Constructor Summary
Constructors Constructor Description NativeJavahMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
attachGeneratedIncludeFilesAsIncZip()
private JavahConfiguration
createProviderConfiguration(java.lang.String[] classNames, java.lang.String javahOutputFileName)
private void
discoverAdditionalJNIClassName()
Get applicable class names to be "javahed"void
execute()
private Javah
getJavah()
private java.util.List<org.apache.maven.artifact.Artifact>
getJavahArtifacts()
Get all jars in the pom excluding transitive, test, and provided scope dependencies.private java.lang.String[]
getJavahClassPath()
Build classpaths from dependent jars including project output directory (i.e.protected JavahConfiguration
getJavahConfiguration()
Internal only for test harness purposeprotected org.apache.maven.project.MavenProject
getProject()
Internal for unit test only-
Methods inherited from class org.codehaus.mojo.natives.plugin.AbstractNativeMojo
getAllCompilersOutputFileList, getEnvFactory, removeEmptyOptions, saveCompilerOutputFilePaths
-
-
-
-
Field Detail
-
javahProvider
@Parameter(defaultValue="default", required=true) private java.lang.String javahProvider
Javah Provider.- Since:
- 1.0-alpha-2
-
javahClassNames
@Parameter private java.util.List<java.lang.String> 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
@Parameter(defaultValue="false") private boolean javahSearchJNIFromDependencies
Enable the search from project dependencies for JNI interfaces, in addition to javahClassNames- Since:
- 1.0-alpha-4
-
javahPath
@Parameter 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
@Parameter(defaultValue="${project.build.directory}/native/javah", required=true) protected java.io.File javahOutputDirectory
Where to place javah generated file- Since:
- 1.0-alpha-2
-
javahOutputFileName
@Parameter 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
@Parameter private java.util.List<JavahInclude> 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
@Parameter(defaultValue="false") private boolean javahVerbose
Enable javah verbose mode- Since:
- 1.0-alpha-2
-
attach
@Parameter(defaultValue="false") private boolean attach
Archive all generated include files and deploy as an inczip
-
classifier
@Parameter(defaultValue="javah") private java.lang.String classifier
Classifier name when install/deploy generated includes file. See ${attach} for details
-
incZipFile
@Parameter(defaultValue="${project.build.directory}/${project.build.finalName}.inczip", required=true) private java.io.File incZipFile
Archive file to bundle all generated include files if enable by ${attach}- Since:
- 1.0-alpha-8
-
useEnvClasspath
@Parameter(defaultValue="false") private boolean useEnvClasspath
Set CLASSPATH env variable instead of using -classpath command-line argument. Use this option to allow large number of jars in classpath due to command line size limit under Windows- Since:
- 1.0-alpha-9
-
manager
@Component private JavahManager manager
Internal: To look up javah implementation- Since:
- 1.0-alpha-2
-
projectHelper
@Component private org.apache.maven.project.MavenProjectHelper projectHelper
Maven ProjectHelper.- Since:
- 1.0-alpha-8
-
config
private JavahConfiguration config
For unit test only
-
-
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<org.apache.maven.artifact.Artifact> 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)
-
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 classAbstractNativeMojo
-
-