Package org.codehaus.mojo.natives.plugin
Class NativeLinkMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.codehaus.mojo.natives.plugin.AbstractNativeMojo
-
- org.codehaus.mojo.natives.plugin.NativeLinkMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="link", defaultPhase=PACKAGE, requiresDependencyResolution=RUNTIME) public class NativeLinkMojo extends AbstractNativeMojoLink all previously built object and dependent library files into final build artifact
-
-
Field Summary
Fields Modifier and Type Field Description private org.apache.maven.artifact.factory.ArtifactFactoryartifactFactoryprivate booleanattachAttach the linker's outputs to maven project be installed/deployed.private booleancheckStaleLinkageEnable this option to speed up linkage for large project with no dependencies changesprivate java.lang.StringclassifierOption to install primary artifact as a classifier, useful to install/deploy debug artifactsprivate java.lang.StringcompilerProviderOverride this property if permitted by compilerProviderprivate LinkerConfigurationconfigFor unit test onlyprivate java.io.FileexternalLibDirectoryDependent libraries with version + classifier removed are copied to this directory to be linked to the build artifactprivate java.util.ListlinkerEndOptionsAdditional linker command optionsprivate java.lang.StringlinkerExecutableOverride this property if permitted by linkerProvider.private java.lang.StringlinkerFinalNameThe name of the generated fileprivate java.util.ListlinkerMiddleOptionsAdditional linker command optionsprotected java.io.FilelinkerOutputDirectoryWhere to place the final packagingprivate java.lang.StringlinkerProviderDefault value is ${compilerProvider}private java.lang.StringlinkerSecondaryOutputExtensionsComma separated extension type to be installed/deployed.private java.util.ListlinkerStartOptionsAdditional linker command optionsprivate java.util.ListlinkingOrderLibsOption to reorder dependency list, each item has the format of ${groupId}:${artifactId}private LinkerManagermanagerprivate booleanusingLinkerResponseFileFor project with lots of object files on windows, turn this flag to resolve Windows commandline length limit-
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, workingDirectory
-
-
Constructor Summary
Constructors Constructor Description NativeLinkMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidattachPrimaryArtifact()private voidattachSecondaryArtifacts()private LinkerConfigurationcreateLinkerConfiguration()voidexecute()private java.util.ListgetDependenciesFileOrderList()convert dependencyLinkingOrders to a file listprivate java.io.FilegetDependencyFile(org.apache.maven.artifact.Artifact artifact, boolean doCopy)protected LinkerConfigurationgetLgetLinkerConfiguration()private java.util.ListgetLibFileNames()private LinkergetLinker()private org.apache.maven.artifact.ArtifactlookupDependencyUsingGroupArtifactIdPair(java.lang.String groupArtifactIdPair)Look up library in dependency list using groupId:artifactId key Note: we can not use project.artifactMap due the introduction of inczip dependency where 2 dependency with the same artifactId and groupId, but differs by extension type make the map not suitable for lookupprivate java.util.ListreorderLibDependencies(java.util.List libs)-
Methods inherited from class org.codehaus.mojo.natives.plugin.AbstractNativeMojo
getAllCompilersOutputFileList, getEnvFactory, getProject, removeEmptyOptions, saveCompilerOutputFilePaths
-
-
-
-
Field Detail
-
compilerProvider
@Parameter(defaultValue="generic", required=true) private java.lang.String compilerProviderOverride this property if permitted by compilerProvider
-
linkerProvider
@Parameter private java.lang.String linkerProvider
Default value is ${compilerProvider}
-
linkerExecutable
@Parameter private java.lang.String linkerExecutable
Override this property if permitted by linkerProvider. Default to compilerType if not provided
-
linkerStartOptions
@Parameter private java.util.List linkerStartOptions
Additional linker command options
-
linkerMiddleOptions
@Parameter private java.util.List linkerMiddleOptions
Additional linker command options
-
linkerEndOptions
@Parameter private java.util.List linkerEndOptions
Additional linker command options
-
linkingOrderLibs
@Parameter private java.util.List linkingOrderLibs
Option to reorder dependency list, each item has the format of ${groupId}:${artifactId}
-
linkerSecondaryOutputExtensions
@Parameter(defaultValue="") private java.lang.String linkerSecondaryOutputExtensions
Comma separated extension type to be installed/deployed. Use this option to deploy library file produced by dll build on windows
-
linkerOutputDirectory
@Parameter(defaultValue="${project.build.directory}", required=true) protected java.io.File linkerOutputDirectoryWhere to place the final packaging
-
linkerFinalName
@Parameter(defaultValue="${project.build.finalName}", required=true) private java.lang.String linkerFinalNameThe name of the generated file
-
manager
@Component private LinkerManager manager
-
artifactFactory
@Component private org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
-
externalLibDirectory
@Parameter(defaultValue="${project.build.directory}/lib") private java.io.File externalLibDirectoryDependent libraries with version + classifier removed are copied to this directory to be linked to the build artifact
-
classifier
@Parameter private java.lang.String classifier
Option to install primary artifact as a classifier, useful to install/deploy debug artifacts
-
attach
@Parameter(defaultValue="true") private boolean attach
Attach the linker's outputs to maven project be installed/deployed. Turn this off if you have other mean of deployment, for example using maven-assembly-plugin to deploy your own bundle
-
usingLinkerResponseFile
@Parameter(defaultValue="false") private boolean usingLinkerResponseFile
For project with lots of object files on windows, turn this flag to resolve Windows commandline length limit
-
checkStaleLinkage
@Parameter(defaultValue="false") private boolean checkStaleLinkage
Enable this option to speed up linkage for large project with no dependencies changes
-
config
private LinkerConfiguration config
For unit test only
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
createLinkerConfiguration
private LinkerConfiguration createLinkerConfiguration() throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getLinker
private Linker getLinker() throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
attachPrimaryArtifact
private void attachPrimaryArtifact()
-
attachSecondaryArtifacts
private void attachSecondaryArtifacts()
-
getLibFileNames
private java.util.List getLibFileNames() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getDependenciesFileOrderList
private java.util.List getDependenciesFileOrderList() throws org.apache.maven.plugin.MojoExecutionExceptionconvert dependencyLinkingOrders to a file list- Throws:
org.apache.maven.plugin.MojoExecutionException
-
lookupDependencyUsingGroupArtifactIdPair
private org.apache.maven.artifact.Artifact lookupDependencyUsingGroupArtifactIdPair(java.lang.String groupArtifactIdPair) throws org.apache.maven.plugin.MojoExecutionExceptionLook up library in dependency list using groupId:artifactId key Note: we can not use project.artifactMap due the introduction of inczip dependency where 2 dependency with the same artifactId and groupId, but differs by extension type make the map not suitable for lookup- Throws:
org.apache.maven.plugin.MojoExecutionException
-
reorderLibDependencies
private java.util.List reorderLibDependencies(java.util.List libs) throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getDependencyFile
private java.io.File getDependencyFile(org.apache.maven.artifact.Artifact artifact, boolean doCopy) throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getLgetLinkerConfiguration
protected LinkerConfiguration getLgetLinkerConfiguration()
-
-