Package org.fusesource.hawtjni.maven
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
archiverManager
protected org.apache.maven.artifact.factory.ArtifactFactory
artifactFactory
Artifact factory, needed to download the package source fileprotected org.apache.maven.artifact.resolver.ArtifactResolver
artifactResolver
Artifact resolver, needed to download the package source fileprivate java.util.List<java.lang.String>
autogenArgs
Extra arguments you want to pass to the autogen.sh command.private java.io.File
buildDirectory
The directory where the build will be produced.private CLI
cli
private java.util.List<java.lang.String>
configureArgs
Extra arguments you want to pass to the configure command.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?private boolean
forceAutogen
Should we force executing the autogen.sh file.private boolean
forceConfigure
Should we force executing the configure command.private java.io.File
libDirectory
The output directory where the built JNI library will placed.protected org.apache.maven.artifact.repository.ArtifactRepository
localRepository
Local maven repository.private java.lang.String
name
The base name of the library, used to determine generated file names.private org.apache.maven.model.Dependency
nativeSrcDependency
The dependency to download to get the native sources.private java.lang.String
nativeSrcUrl
URL to where we can down the source packageprivate java.io.File
packageDirectory
Where the unpacked build package is located.private java.lang.String
platform
The platform identifier of this build.protected org.apache.maven.project.MavenProject
project
The maven project.protected java.util.List
remoteArtifactRepositories
Remote repositoriesprivate boolean
skipAutogen
Should we skip executing the autogen.sh file.private boolean
skipConfigure
Should we skip executing the configure command.private java.lang.String
sourceClassifier
The classifier of the package archive that will be created.private boolean
verbose
Should we display all the native build output?private java.lang.String
windowsBuildTool
The build tool to use on Windows systems.private java.lang.String
windowsProjectName
The name of the msbuild/vcbuild project to use.
-
Constructor Summary
Constructors Constructor Description BuildMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
configureBasedBuild(java.io.File buildDir)
void
downloadNativeSourcePackage(java.io.File buildDir)
void
execute()
private java.io.File
findSourceRoot(java.io.File dest)
private void
vsBasedBuild(java.io.File buildDir)
-
-
-
Field Detail
-
project
@Parameter(defaultValue="${project}", readonly=true) protected org.apache.maven.project.MavenProject project
The maven project.
-
remoteArtifactRepositories
@Parameter(defaultValue="${project.remoteArtifactRepositories}", readonly=true) protected java.util.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 java.lang.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 java.io.File packageDirectory
Where the unpacked build package is located.
-
libDirectory
@Parameter(defaultValue="${project.build.directory}/generated-sources/hawtjni/lib") private java.io.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 java.io.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 java.util.List<java.lang.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 java.util.List<java.lang.String> configureArgs
Extra arguments you want to pass to the configure command.
-
platform
@Parameter private java.lang.String platform
The platform identifier of this build. If not specified, it will be automatically detected.
-
sourceClassifier
@Parameter(defaultValue="native-src") private java.lang.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 java.lang.String nativeSrcUrl
URL to where we can down the source package
-
windowsBuildTool
@Parameter(defaultValue="detect") private java.lang.String windowsBuildTool
The build tool to use on Windows systems. Set to 'msbuild', 'vcbuild', or 'detect'
-
windowsProjectName
@Parameter private java.lang.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
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
vsBasedBuild
private void vsBasedBuild(java.io.File buildDir) throws org.codehaus.plexus.util.cli.CommandLineException, org.apache.maven.plugin.MojoExecutionException, java.io.IOException
- Throws:
org.codehaus.plexus.util.cli.CommandLineException
org.apache.maven.plugin.MojoExecutionException
java.io.IOException
-
configureBasedBuild
private void configureBasedBuild(java.io.File buildDir) throws java.io.IOException, org.apache.maven.plugin.MojoExecutionException, org.codehaus.plexus.util.cli.CommandLineException
- Throws:
java.io.IOException
org.apache.maven.plugin.MojoExecutionException
org.codehaus.plexus.util.cli.CommandLineException
-
downloadNativeSourcePackage
public void downloadNativeSourcePackage(java.io.File buildDir) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
findSourceRoot
private java.io.File findSourceRoot(java.io.File dest)
-
-