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
FieldsModifier and TypeFieldDescriptionprivate booleanArchive all generated include files and deploy as an inczipprivate StringClassifier name when install/deploy generated includes file.private JavahConfigurationFor unit test onlyprivate FileArchive file to bundle all generated include files if enable by ${attach}List of class names to generate native files.private List<JavahInclude> Additional javah classname and its corresponding header name.protected FileWhere to place javah generated fileprivate Stringif configured, this value will be combined with outputDirectory to pass into javah's -o optionprivate FilePath to javah executable, if present, it will override the default one which bases on architecture type.private StringJavah Provider.private booleanEnable the search from project dependencies for JNI interfaces, in addition to javahClassNamesprivate booleanEnable javah verbose modeprivate JavahManagerInternal: To look up javah implementationprivate org.apache.maven.project.MavenProjectHelperMaven ProjectHelper.private booleanSet 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, workingDirectoryFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate JavahConfigurationcreateProviderConfiguration(String[] classNames, String javahOutputFileName) private voidGet applicable class names to be "javahed"voidexecute()private JavahgetJavah()private List<org.apache.maven.artifact.Artifact> Get all jars in the pom excluding transitive, test, and provided scope dependencies.private String[]Build classpaths from dependent jars including project output directory (i.e.protected JavahConfigurationInternal only for test harness purposeprotected org.apache.maven.project.MavenProjectInternal for unit test onlyMethods inherited from class org.codehaus.mojo.natives.plugin.AbstractNativeMojo
getAllCompilersOutputFileList, getEnvFactory, removeEmptyOptions, saveCompilerOutputFilePathsMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
javahProvider
Javah Provider.- Since:
- 1.0-alpha-2
-
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 javahSearchJNIFromDependenciesEnable the search from project dependencies for JNI interfaces, in addition to javahClassNames- Since:
- 1.0-alpha-4
-
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 File javahOutputDirectoryWhere to place javah generated file- Since:
- 1.0-alpha-2
-
javahOutputFileName
if configured, this value will be combined with outputDirectory to pass into javah's -o option- Since:
- 1.0-alpha-4
-
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 javahVerboseEnable javah verbose mode- Since:
- 1.0-alpha-2
-
attach
@Parameter(defaultValue="false") private boolean attachArchive all generated include files and deploy as an inczip -
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 File incZipFileArchive file to bundle all generated include files if enable by ${attach}- Since:
- 1.0-alpha-8
-
useEnvClasspath
@Parameter(defaultValue="false") private boolean useEnvClasspathSet 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
Internal: To look up javah implementation- Since:
- 1.0-alpha-2
-
projectHelper
@Component private org.apache.maven.project.MavenProjectHelper projectHelperMaven ProjectHelper.- Since:
- 1.0-alpha-8
-
config
For unit test only
-
-
Constructor Details
-
NativeJavahMojo
public NativeJavahMojo()
-
-
Method Details
-
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
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getJavahArtifacts
Get all jars in the pom excluding transitive, test, and provided scope dependencies.- Returns:
-
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(String[] classNames, String javahOutputFileName) -
getJavahConfiguration
Internal only for test harness purpose- Returns:
-
getProject
protected org.apache.maven.project.MavenProject getProject()Internal for unit test only- Overrides:
getProjectin classAbstractNativeMojo
-