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
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 booleanattachArchive all generated include files and deploy as an inczipprivate java.lang.StringclassifierClassifier name when install/deploy generated includes file.private JavahConfigurationconfigFor unit test onlyprivate java.io.FileincZipFileArchive file to bundle all generated include files if enable by ${attach}private java.util.ListjavahClassNamesList of class names to generate native files.private java.util.ListjavahIncludesAdditional javah classname and its corresponding header name.protected java.io.FilejavahOutputDirectoryWhere to place javah generated fileprivate java.lang.StringjavahOutputFileNameif configured, this value will be combined with outputDirectory to pass into javah's -o optionprivate java.io.FilejavahPathPath to javah executable, if present, it will override the default one which bases on architecture type.private java.lang.StringjavahProviderJavah Provider.private booleanjavahSearchJNIFromDependenciesEnable the search from project dependencies for JNI interfaces, in addition to javahClassNamesprivate booleanjavahVerboseEnable javah verbose modeprivate JavahManagermanagerInternal: To look up javah implementationprivate org.apache.maven.project.MavenProjectHelperprojectHelperMaven ProjectHelper.-
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 voidattachGeneratedIncludeFilesAsIncZip()private JavahConfigurationcreateProviderConfiguration(java.lang.String[] classNames, java.lang.String javahOutputFileName)private voiddiscoverAdditionalJNIClassName()Get applicable class names to be "javahed"voidexecute()private JavahgetJavah()private java.util.ListgetJavahArtifacts()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 JavahConfigurationgetJavahConfiguration()Internal only for test harness purposeprotected org.apache.maven.project.MavenProjectgetProject()Internal for unit test only-
Methods inherited from class org.codehaus.mojo.natives.plugin.AbstractNativeMojo
getAllCompilersOutputFileList, getEnvFactory, removeEmptyOptions, saveCompilerOutputFilePaths
-
-
-
-
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
-
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 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.MojoExecutionExceptionGet 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:
getProjectin classAbstractNativeMojo
-
-