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.AbstractMojoThis 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.ArchiverManagerarchiverManagerprotected org.apache.maven.artifact.factory.ArtifactFactoryartifactFactoryArtifact factory, needed to download the package source fileprotected org.apache.maven.artifact.resolver.ArtifactResolverartifactResolverArtifact resolver, needed to download the package source fileprivate java.util.List<java.lang.String>autogenArgsExtra arguments you want to pass to the autogen.sh command.private java.io.FilebuildDirectoryThe directory where the build will be produced.private CLIcliprivate java.util.List<java.lang.String>configureArgsExtra arguments you want to pass to the configure command.private booleandownloadSourcePackageIf 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 booleanforceAutogenShould we force executing the autogen.sh file.private booleanforceConfigureShould we force executing the configure command.private java.io.FilelibDirectoryThe output directory where the built JNI library will placed.protected org.apache.maven.artifact.repository.ArtifactRepositorylocalRepositoryLocal maven repository.private java.lang.StringnameThe base name of the library, used to determine generated file names.private org.apache.maven.model.DependencynativeSrcDependencyThe dependency to download to get the native sources.private java.lang.StringnativeSrcUrlURL to where we can down the source packageprivate java.io.FilepackageDirectoryWhere the unpacked build package is located.private java.lang.StringplatformThe platform identifier of this build.protected org.apache.maven.project.MavenProjectprojectThe maven project.protected java.util.ListremoteArtifactRepositoriesRemote repositoriesprivate booleanskipAutogenShould we skip executing the autogen.sh file.private booleanskipConfigureShould we skip executing the configure command.private java.lang.StringsourceClassifierThe classifier of the package archive that will be created.private booleanverboseShould we display all the native build output?private java.lang.StringwindowsBuildToolThe build tool to use on Windows systems.private java.lang.StringwindowsProjectNameThe 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 voidconfigureBasedBuild(java.io.File buildDir)voiddownloadNativeSourcePackage(java.io.File buildDir)voidexecute()private java.io.FilefindSourceRoot(java.io.File dest)private voidvsBasedBuild(java.io.File buildDir)
-
-
-
Field Detail
-
project
@Parameter(defaultValue="${project}", readonly=true) protected org.apache.maven.project.MavenProject projectThe maven project.
-
remoteArtifactRepositories
@Parameter(defaultValue="${project.remoteArtifactRepositories}", readonly=true) protected java.util.List remoteArtifactRepositoriesRemote repositories
-
localRepository
@Parameter(defaultValue="${localRepository}", readonly=true) protected org.apache.maven.artifact.repository.ArtifactRepository localRepositoryLocal 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 nameThe 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 packageDirectoryWhere the unpacked build package is located.
-
libDirectory
@Parameter(defaultValue="${project.build.directory}/generated-sources/hawtjni/lib") private java.io.File libDirectoryThe 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 buildDirectoryThe 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 skipAutogenShould we skip executing the autogen.sh file.
-
forceAutogen
@Parameter(defaultValue="${force-autogen}") private boolean forceAutogenShould 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 skipConfigureShould we skip executing the configure command.
-
forceConfigure
@Parameter(defaultValue="${force-configure}") private boolean forceConfigureShould we force executing the configure command.
-
verbose
@Parameter(defaultValue="${hawtjni-verbose}") private boolean verboseShould 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 nativeSrcUrlURL 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.CommandLineExceptionorg.apache.maven.plugin.MojoExecutionExceptionjava.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.IOExceptionorg.apache.maven.plugin.MojoExecutionExceptionorg.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)
-
-