Class BuildMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.fusesource.hawtjni.maven.BuildMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="build", defaultPhase=GENERATE_TEST_RESOURCES) public class BuildMojo extends org.apache.maven.plugin.AbstractMojo
This goal builds the JNI module which was previously generated with the generate goal. It adds the JNI module to the test resource path so that unit tests can load the freshly built JNI library.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private org.codehaus.plexus.archiver.manager.ArchiverManager
     
    protected org.apache.maven.artifact.factory.ArtifactFactory
    Artifact factory, needed to download the package source file
    protected org.apache.maven.artifact.resolver.ArtifactResolver
    Artifact resolver, needed to download the package source file
    private List<String>
    Extra arguments you want to pass to the autogen.sh command.
    private File
    The directory where the build will be produced.
    private final CLI
     
    private List<String>
    Extra arguments you want to pass to the configure command.
    private boolean
    If the source build could not be fully generated, perhaps the autotools were not available on this platform, should we attempt to download a previously deployed source package and build that?
    private boolean
    Should we force executing the autogen.sh file.
    private boolean
    Should we force executing the configure command.
    private File
    The output directory where the built JNI library will placed.
    protected org.apache.maven.artifact.repository.ArtifactRepository
    Local maven repository.
    private String
    The base name of the library, used to determine generated file names.
    private org.apache.maven.model.Dependency
    The dependency to download to get the native sources.
    private String
    URL to where we can down the source package
    private File
    Where the unpacked build package is located.
    private String
    The platform identifier of this build.
    protected org.apache.maven.project.MavenProject
    The maven project.
    protected List
    Remote repositories
    private boolean
    Should we skip executing the autogen.sh file.
    private boolean
    Should we skip executing the configure command.
    private String
    The classifier of the package archive that will be created.
    private boolean
    Should we display all the native build output?
    private String
    The build tool to use on Windows systems.
    private String
    The name of the msbuild/vcbuild project to use.

    Fields inherited from interface org.apache.maven.plugin.Mojo

    ROLE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private void
     
    void
     
    void
     
    private File
     
    private void
    vsBasedBuild(File buildDir)
     

    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 Details

    • project

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

      @Parameter(defaultValue="${project.remoteArtifactRepositories}", readonly=true) protected List remoteArtifactRepositories
      Remote repositories
    • localRepository

      @Parameter(defaultValue="${localRepository}", readonly=true) protected org.apache.maven.artifact.repository.ArtifactRepository localRepository
      Local maven repository.
    • artifactFactory

      @Component protected org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
      Artifact factory, needed to download the package source file
    • artifactResolver

      @Component protected org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver
      Artifact resolver, needed to download the package source file
    • archiverManager

      @Component private org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager
    • name

      @Parameter(defaultValue="${project.artifactId}") private String name
      The base name of the library, used to determine generated file names.
    • packageDirectory

      @Parameter(defaultValue="${project.build.directory}/generated-sources/hawtjni/native-package") private File packageDirectory
      Where the unpacked build package is located.
    • libDirectory

      @Parameter(defaultValue="${project.build.directory}/generated-sources/hawtjni/lib") private File libDirectory
      The output directory where the built JNI library will placed. This directory will be added to as a test resource path so that unit tests can verify the built JNI library. The library will placed under the META-INF/native/${platform} directory that the HawtJNI Library uses to find JNI libraries as classpath resources.
    • buildDirectory

      @Parameter(defaultValue="${project.build.directory}") private File buildDirectory
      The directory where the build will be produced. It creates a native-build and native-dist directory under the specified directory.
    • skipAutogen

      @Parameter(defaultValue="${skip-autogen}") private boolean skipAutogen
      Should we skip executing the autogen.sh file.
    • forceAutogen

      @Parameter(defaultValue="${force-autogen}") private boolean forceAutogen
      Should we force executing the autogen.sh file.
    • autogenArgs

      @Parameter private List<String> autogenArgs
      Extra arguments you want to pass to the autogen.sh command.
    • skipConfigure

      @Parameter(defaultValue="${skip-configure}") private boolean skipConfigure
      Should we skip executing the configure command.
    • forceConfigure

      @Parameter(defaultValue="${force-configure}") private boolean forceConfigure
      Should we force executing the configure command.
    • verbose

      @Parameter(defaultValue="${hawtjni-verbose}") private boolean verbose
      Should we display all the native build output?
    • configureArgs

      @Parameter private List<String> configureArgs
      Extra arguments you want to pass to the configure command.
    • platform

      @Parameter private String platform
      The platform identifier of this build. If not specified, it will be automatically detected.
    • sourceClassifier

      @Parameter(defaultValue="native-src") private String sourceClassifier
      The classifier of the package archive that will be created.
    • downloadSourcePackage

      @Parameter(defaultValue="true") private boolean downloadSourcePackage
      If the source build could not be fully generated, perhaps the autotools were not available on this platform, should we attempt to download a previously deployed source package and build that?
    • nativeSrcDependency

      @Parameter private org.apache.maven.model.Dependency nativeSrcDependency
      The dependency to download to get the native sources.
    • nativeSrcUrl

      @Parameter(defaultValue="${native-src-url}") private String nativeSrcUrl
      URL to where we can down the source package
    • windowsBuildTool

      @Parameter(defaultValue="detect") private String windowsBuildTool
      The build tool to use on Windows systems. Set to 'msbuild', 'vcbuild', or 'detect'
    • windowsProjectName

      @Parameter private String windowsProjectName
      The name of the msbuild/vcbuild project to use. Defaults to 'vs2010' for 'msbuild' and 'vs2008' for 'vcbuild'.
    • cli

      private final CLI cli
  • Constructor Details

    • BuildMojo

      public BuildMojo()
  • Method Details

    • execute

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

      private void vsBasedBuild(File buildDir) throws org.codehaus.plexus.util.cli.CommandLineException, org.apache.maven.plugin.MojoExecutionException, IOException
      Throws:
      org.codehaus.plexus.util.cli.CommandLineException
      org.apache.maven.plugin.MojoExecutionException
      IOException
    • configureBasedBuild

      private void configureBasedBuild(File buildDir) throws IOException, org.apache.maven.plugin.MojoExecutionException, org.codehaus.plexus.util.cli.CommandLineException
      Throws:
      IOException
      org.apache.maven.plugin.MojoExecutionException
      org.codehaus.plexus.util.cli.CommandLineException
    • downloadNativeSourcePackage

      public void downloadNativeSourcePackage(File buildDir) throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • findSourceRoot

      private File findSourceRoot(File dest)