Class BuildMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
    Direct Known Subclasses:
    ParseMojo

    @Mojo(name="build",
          defaultPhase=PROCESS_CLASSES,
          threadSafe=true)
    public class BuildMojo
    extends org.apache.maven.plugin.AbstractMojo
    A Maven Mojo to call the Builder (C++ header file -> Java class -> C++ JNI -> native library). Can also be considered as an example of how to use the Builder programmatically.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) java.lang.String[] buildCommand
      Execute a build command instead of JavaCPP itself, and return.
      (package private) java.lang.String buildPath
      Add the path to the "platform.buildpath" property.
      (package private) java.lang.String[] buildPaths
      Add the paths to the "platform.buildpath" property.
      (package private) java.lang.String buildResource
      Add the path to the "platform.buildresource" property.
      (package private) java.lang.String[] buildResources
      Add the paths to the "platform.buildresource" property.
      (package private) java.lang.String classOrPackageName
      Process only this class or package (suffixed with .* or .**).
      (package private) java.lang.String[] classOrPackageNames
      Process only these classes or packages (suffixed with .* or .**).
      (package private) java.lang.String classPath
      Load user classes from classPath.
      (package private) java.lang.String[] classPaths
      Load user classes from classPaths.
      (package private) boolean clean
      Delete all files from outputDirectory before generating anything in it.
      (package private) boolean compile
      Compile and delete the generated .cpp files.
      (package private) java.lang.String[] compilerOptions
      Pass compilerOptions directly to compiler.
      (package private) java.lang.String configDirectory
      Also create config files for GraalVM native-image in directory.
      (package private) boolean copyLibs
      Copy to output directory dependent libraries (link and preload).
      (package private) boolean copyResources
      Copy to output directory resources listed in properties.
      (package private) boolean deleteJniFiles
      Delete generated C++ JNI files after compilation
      (package private) java.lang.String encoding
      Specify the character encoding used for input and output.
      (package private) java.util.Map<java.lang.String,​java.lang.String> environmentVariables
      Add environment variables to the compiler subprocess.
      (package private) java.lang.String executablePath
      Add the path to the "platform.executablepath" property.
      (package private) java.lang.String[] executablePaths
      Add the paths to the "platform.executablepath" property.
      (package private) boolean generate
      Generate .cpp files from Java interfaces if found, parsing from header files if not.
      (package private) boolean header
      Generate header file with declarations of callbacks functions.
      (package private) java.lang.String includePath
      Add the path to the "platform.includepath" property.
      (package private) java.lang.String[] includePaths
      Add the paths to the "platform.includepath" property.
      (package private) java.lang.String includeResource
      Add the path to the "platform.includeresource" property.
      (package private) java.lang.String[] includeResources
      Add the paths to the "platform.includeresource" property.
      (package private) java.lang.String jarPrefix
      Also create a JAR file named <jarPrefix>-<platform>.jar.
      (package private) java.lang.String linkPath
      Add the path to the "platform.linkpath" property.
      (package private) java.lang.String[] linkPaths
      Add the paths to the "platform.linkpath" property.
      (package private) java.lang.String linkResource
      Add the path to the "platform.linkresource" property.
      (package private) java.lang.String[] linkResources
      Add the paths to the "platform.linkresource" property.
      (package private) java.io.File outputDirectory
      Output all generated files to outputDirectory.
      (package private) java.lang.String outputName
      Output everything in a file named after given outputName.
      (package private) org.apache.maven.plugin.descriptor.PluginDescriptor plugin  
      (package private) java.lang.String preloadPath
      Add the path to the "platform.preloadpath" property.
      (package private) java.lang.String[] preloadPaths
      Add the paths to the "platform.preloadpath" property.
      (package private) java.lang.String preloadResource
      Add the path to the "platform.preloadresource" property.
      (package private) java.lang.String[] preloadResources
      Add the paths to the "platform.preloadresource" property.
      (package private) org.apache.maven.project.MavenProject project  
      (package private) java.lang.String properties
      Load all properties from resource.
      (package private) java.io.File propertyFile
      Load all properties from file.
      (package private) java.util.Properties propertyKeysAndValues
      Set property keys to values.
      (package private) java.lang.String resourcePath
      Add the path to the "platform.resourcepath" property.
      (package private) java.lang.String[] resourcePaths
      Add the paths to the "platform.resourcepath" property.
      (package private) boolean skip
      Skip the execution.
      (package private) java.lang.String[] targetDirectories
      Add to Maven project source directory of Java files generated by buildCommand.
      (package private) java.lang.String targetDirectory
      Add to Maven project source directory of Java files generated by buildCommand.
      (package private) java.io.File workingDirectory
      Set the working directory of the build subprocess.
      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Constructor Summary

      Constructors 
      Constructor Description
      BuildMojo()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void execute()  
      (package private) static java.lang.String[] merge​(java.lang.String[] ss, java.lang.String s)  
      • Methods inherited from class org.apache.maven.plugin.AbstractMojo

        getLog, getPluginContext, setLog, setPluginContext
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • classPath

        @Parameter(property="javacpp.classPath",
                   defaultValue="${project.build.outputDirectory}")
        java.lang.String classPath
        Load user classes from classPath.
      • classPaths

        @Parameter(property="javacpp.classPaths")
        java.lang.String[] classPaths
        Load user classes from classPaths.
      • includePath

        @Parameter(property="javacpp.includePath")
        java.lang.String includePath
        Add the path to the "platform.includepath" property.
      • includePaths

        @Parameter(property="javacpp.includePaths")
        java.lang.String[] includePaths
        Add the paths to the "platform.includepath" property.
      • includeResource

        @Parameter(property="javacpp.includeResource")
        java.lang.String includeResource
        Add the path to the "platform.includeresource" property.
      • includeResources

        @Parameter(property="javacpp.includeResources")
        java.lang.String[] includeResources
        Add the paths to the "platform.includeresource" property.
      • buildPath

        @Parameter(property="javacpp.buildPath")
        java.lang.String buildPath
        Add the path to the "platform.buildpath" property.
      • buildPaths

        @Parameter(property="javacpp.buildPaths")
        java.lang.String[] buildPaths
        Add the paths to the "platform.buildpath" property.
      • buildResource

        @Parameter(property="javacpp.buildResource")
        java.lang.String buildResource
        Add the path to the "platform.buildresource" property.
      • buildResources

        @Parameter(property="javacpp.buildResources")
        java.lang.String[] buildResources
        Add the paths to the "platform.buildresource" property.
      • linkPath

        @Parameter(property="javacpp.linkPath")
        java.lang.String linkPath
        Add the path to the "platform.linkpath" property.
      • linkPaths

        @Parameter(property="javacpp.linkPaths")
        java.lang.String[] linkPaths
        Add the paths to the "platform.linkpath" property.
      • linkResource

        @Parameter(property="javacpp.linkResource")
        java.lang.String linkResource
        Add the path to the "platform.linkresource" property.
      • linkResources

        @Parameter(property="javacpp.linkResources")
        java.lang.String[] linkResources
        Add the paths to the "platform.linkresource" property.
      • preloadPath

        @Parameter(property="javacpp.preloadPath")
        java.lang.String preloadPath
        Add the path to the "platform.preloadpath" property.
      • preloadPaths

        @Parameter(property="javacpp.preloadPaths")
        java.lang.String[] preloadPaths
        Add the paths to the "platform.preloadpath" property.
      • preloadResource

        @Parameter(property="javacpp.preloadResource")
        java.lang.String preloadResource
        Add the path to the "platform.preloadresource" property.
      • preloadResources

        @Parameter(property="javacpp.preloadResources")
        java.lang.String[] preloadResources
        Add the paths to the "platform.preloadresource" property.
      • resourcePath

        @Parameter(property="javacpp.resourcePath")
        java.lang.String resourcePath
        Add the path to the "platform.resourcepath" property.
      • resourcePaths

        @Parameter(property="javacpp.resourcePaths")
        java.lang.String[] resourcePaths
        Add the paths to the "platform.resourcepath" property.
      • executablePath

        @Parameter(property="javacpp.executablePath")
        java.lang.String executablePath
        Add the path to the "platform.executablepath" property.
      • executablePaths

        @Parameter(property="javacpp.executablePaths")
        java.lang.String[] executablePaths
        Add the paths to the "platform.executablepath" property.
      • encoding

        @Parameter(property="javacpp.encoding")
        java.lang.String encoding
        Specify the character encoding used for input and output.
      • outputDirectory

        @Parameter(property="javacpp.outputDirectory")
        java.io.File outputDirectory
        Output all generated files to outputDirectory.
      • outputName

        @Parameter(property="javacpp.outputName")
        java.lang.String outputName
        Output everything in a file named after given outputName.
      • clean

        @Parameter(property="javacpp.clean",
                   defaultValue="false")
        boolean clean
        Delete all files from outputDirectory before generating anything in it.
      • generate

        @Parameter(property="javacpp.generate",
                   defaultValue="true")
        boolean generate
        Generate .cpp files from Java interfaces if found, parsing from header files if not.
      • compile

        @Parameter(property="javacpp.compile",
                   defaultValue="true")
        boolean compile
        Compile and delete the generated .cpp files.
      • deleteJniFiles

        @Parameter(property="javacpp.deleteJniFiles",
                   defaultValue="true")
        boolean deleteJniFiles
        Delete generated C++ JNI files after compilation
      • header

        @Parameter(property="javacpp.header",
                   defaultValue="false")
        boolean header
        Generate header file with declarations of callbacks functions.
      • copyLibs

        @Parameter(property="javacpp.copyLibs",
                   defaultValue="false")
        boolean copyLibs
        Copy to output directory dependent libraries (link and preload).
      • copyResources

        @Parameter(property="javacpp.copyResources",
                   defaultValue="false")
        boolean copyResources
        Copy to output directory resources listed in properties.
      • configDirectory

        @Parameter(property="javacpp.configDirectory")
        java.lang.String configDirectory
        Also create config files for GraalVM native-image in directory.
      • jarPrefix

        @Parameter(property="javacpp.jarPrefix")
        java.lang.String jarPrefix
        Also create a JAR file named <jarPrefix>-<platform>.jar.
      • properties

        @Parameter(property="javacpp.properties")
        java.lang.String properties
        Load all properties from resource.
      • propertyFile

        @Parameter(property="javacpp.propertyFile")
        java.io.File propertyFile
        Load all properties from file.
      • propertyKeysAndValues

        @Parameter(property="javacpp.propertyKeysAndValues")
        java.util.Properties propertyKeysAndValues
        Set property keys to values.
      • classOrPackageName

        @Parameter(property="javacpp.classOrPackageName")
        java.lang.String classOrPackageName
        Process only this class or package (suffixed with .* or .**).
      • classOrPackageNames

        @Parameter(property="javacpp.classOrPackageNames")
        java.lang.String[] classOrPackageNames
        Process only these classes or packages (suffixed with .* or .**).
      • buildCommand

        @Parameter(property="javacpp.buildCommand")
        java.lang.String[] buildCommand
        Execute a build command instead of JavaCPP itself, and return.
      • targetDirectory

        @Parameter(property="javacpp.targetDirectory")
        java.lang.String targetDirectory
        Add to Maven project source directory of Java files generated by buildCommand.
      • targetDirectories

        @Parameter(property="javacpp.targetDirectories")
        java.lang.String[] targetDirectories
        Add to Maven project source directory of Java files generated by buildCommand.
      • workingDirectory

        @Parameter(property="javacpp.workingDirectory")
        java.io.File workingDirectory
        Set the working directory of the build subprocess.
      • environmentVariables

        @Parameter(property="javacpp.environmentVariables")
        java.util.Map<java.lang.String,​java.lang.String> environmentVariables
        Add environment variables to the compiler subprocess.
      • compilerOptions

        @Parameter(property="javacpp.compilerOptions")
        java.lang.String[] compilerOptions
        Pass compilerOptions directly to compiler.
      • skip

        @Parameter(property="javacpp.skip",
                   defaultValue="false")
        boolean skip
        Skip the execution.
      • project

        @Parameter(defaultValue="${project}",
                   required=true,
                   readonly=true)
        org.apache.maven.project.MavenProject project
      • plugin

        @Parameter(defaultValue="${plugin}",
                   required=true,
                   readonly=true)
        org.apache.maven.plugin.descriptor.PluginDescriptor plugin
    • Constructor Detail

      • BuildMojo

        public BuildMojo()
    • Method Detail

      • merge

        static java.lang.String[] merge​(java.lang.String[] ss,
                                        java.lang.String s)
      • execute

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