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=COMPILE)
public class NativeLinkMojo
extends AbstractNativeMojo
Link all previously built object and dependent library files into final build artifact
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.apache.maven.artifact.factory.ArtifactFactoryInternalprivate booleanAttach the linker's outputs to maven project be installed/deployed.private booleanEnable this option to speed up linkage for large project with no dependencies changesprivate StringOption to install primary artifact as a classifier, useful to install/deploy debug artifactsprivate StringOverride this property if permitted by compilerProviderprivate LinkerConfigurationFor unit test onlyprivate FileDependent libraries with version + classifier removed are copied to this directory to be linked to the build artifactAdditional linker command optionsprivate StringOverride this property if permitted by linkerProvider.private StringThe name of the generated fileprivate StringThe extension of the generated file.Additional linker command optionsprotected FileWhere to place the final packagingprivate StringDefault value is ${compilerProvider}private StringComma separated extension type to be installed/deployed.Additional linker command optionsOption to reorder dependency list, each item has the format of ${groupId}:${artifactId}private LinkerManagerInternalprivate booleanFor project with lots of object files on windows, turn this flag to resolve Windows commandline length limitFields 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, workingDirectoryFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate voidprivate LinkerConfigurationvoidexecute()convert dependencyLinkingOrders to a file listprivate FilegetDependencyFile(org.apache.maven.artifact.Artifact artifact, boolean doCopy) protected LinkerConfigurationprivate Linkerprivate org.apache.maven.artifact.ArtifactlookupDependencyUsingGroupArtifactIdPair(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 lookupreorderLibDependencies(List<String> libs) Methods inherited from class org.codehaus.mojo.natives.plugin.AbstractNativeMojo
getAllCompilersOutputFileList, getEnvFactory, getProject, removeEmptyOptions, saveCompilerOutputFilePathsMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
compilerProvider
Override this property if permitted by compilerProvider- Since:
- 1.0-alpha-2
-
linkerProvider
Default value is ${compilerProvider}- Since:
- 1.0-alpha-2
-
linkerExecutable
Override this property if permitted by linkerProvider. Default to compilerType if not provided- Since:
- 1.0-alpha-2
-
linkerStartOptions
Additional linker command options- Since:
- 1.0-alpha-2
-
linkerMiddleOptions
Additional linker command options- Since:
- 1.0-alpha-2
-
linkerEndOptions
Additional linker command options- Since:
- 1.0-alpha-2
-
linkingOrderLibs
Option to reorder dependency list, each item has the format of ${groupId}:${artifactId}- Since:
- 1.0-alpha-2
-
linkerSecondaryOutputExtensions
Comma separated extension type to be installed/deployed. Use this option to deploy library file produced by dll build on windows- Since:
- 1.0-alpha-2
-
linkerOutputDirectory
@Parameter(defaultValue="${project.build.directory}", required=true) protected File linkerOutputDirectoryWhere to place the final packaging- Since:
- 1.0-alpha-2
-
linkerFinalName
The name of the generated file- Since:
- 1.0-alpha-8
-
linkerFinalNameExt
@Parameter(defaultValue="${project.artifact.artifactHandler.extension}", required=true) private String linkerFinalNameExtThe extension of the generated file. Unless specified, the extension of the main project artifact is used.- Since:
- 1.0-alpha-9
-
manager
Internal- Since:
- 1.0-alpha-2
-
artifactFactory
@Component private org.apache.maven.artifact.factory.ArtifactFactory artifactFactoryInternal- Since:
- 1.0-alpha-2
-
externalLibDirectory
@Parameter(defaultValue="${project.build.directory}/lib", required=true) private File externalLibDirectoryDependent libraries with version + classifier removed are copied to this directory to be linked to the build artifact -
classifier
Option to install primary artifact as a classifier, useful to install/deploy debug artifacts- Since:
- 1.0-alpha-2
-
attach
@Parameter(defaultValue="true") private boolean attachAttach 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- Since:
- 1.0-alpha-2
-
usingLinkerResponseFile
@Parameter(defaultValue="false") private boolean usingLinkerResponseFileFor project with lots of object files on windows, turn this flag to resolve Windows commandline length limit- Since:
- 1.0-alpha-7
-
checkStaleLinkage
@Parameter(defaultValue="false") private boolean checkStaleLinkageEnable this option to speed up linkage for large project with no dependencies changes- Since:
- 1.0-alpha-8
-
config
For unit test only
-
-
Constructor Details
-
NativeLinkMojo
public NativeLinkMojo()
-
-
Method Details
-
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
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
attachPrimaryArtifact
private void attachPrimaryArtifact() -
attachSecondaryArtifacts
private void attachSecondaryArtifacts() -
getLibFileNames
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getDependenciesFileOrderList
private List<String> getDependenciesFileOrderList() throws org.apache.maven.plugin.MojoExecutionExceptionconvert dependencyLinkingOrders to a file list- Returns:
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
lookupDependencyUsingGroupArtifactIdPair
private org.apache.maven.artifact.Artifact lookupDependencyUsingGroupArtifactIdPair(String groupArtifactIdPair) throws org.apache.maven.plugin.MojoExecutionException 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 lookup- Parameters:
groupArtifactIdPair-- Returns:
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
reorderLibDependencies
private List<String> reorderLibDependencies(List<String> libs) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
getDependencyFile
private File getDependencyFile(org.apache.maven.artifact.Artifact artifact, boolean doCopy) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
getLgetLinkerConfiguration
-