public abstract class AbstractSourceJarMojo
extends org.apache.maven.plugin.AbstractMojo
Modifier and Type | Field and Description |
---|---|
private org.apache.maven.archiver.MavenArchiveConfiguration |
archive
The archive configuration to use.
|
private boolean |
attach
Specifies whether or not to attach the artifact to the project
|
private static java.lang.String[] |
DEFAULT_EXCLUDES |
private static java.lang.String[] |
DEFAULT_INCLUDES |
private java.io.File |
defaultManifestFile
Path to the default MANIFEST file to use.
|
protected boolean |
excludeResources
Specifies whether or not to exclude resources from the sources-jar.
|
private java.lang.String[] |
excludes
List of files to exclude.
|
protected java.lang.String |
finalName
The filename to be used for the generated archive file.
|
private boolean |
forceCreation
Whether creating the archive should be forced.
|
protected boolean |
includePom
Specifies whether or not to include the POM file in the sources-jar.
|
private java.lang.String[] |
includes
List of files to include.
|
private org.codehaus.plexus.archiver.jar.JarArchiver |
jarArchiver
The Jar archiver.
|
protected java.io.File |
outputDirectory
The directory where the generated archive file will be put.
|
private org.apache.maven.project.MavenProject |
project
The Maven Project Object
|
private org.apache.maven.project.MavenProjectHelper |
projectHelper
Used for attaching the source jar to the project.
|
protected java.util.List<org.apache.maven.project.MavenProject> |
reactorProjects
Contains the full list of projects in the reactor.
|
private org.apache.maven.execution.MavenSession |
session
The Maven session.
|
private boolean |
skipSource
A flag used to disable the source procedure.
|
private boolean |
useDefaultExcludes
Exclude commonly excluded files such as SCM configuration.
|
private boolean |
useDefaultManifestFile
Set this to
true to enable the use of the defaultManifestFile . |
Constructor and Description |
---|
AbstractSourceJarMojo() |
Modifier and Type | Method and Description |
---|---|
protected void |
addDirectory(org.codehaus.plexus.archiver.Archiver archiver,
java.io.File sourceDirectory,
java.lang.String[] pIncludes,
java.lang.String[] pExcludes) |
protected void |
addDirectory(org.codehaus.plexus.archiver.Archiver archiver,
java.io.File sourceDirectory,
java.lang.String prefix,
java.lang.String[] pIncludes,
java.lang.String[] pExcludes) |
protected void |
archiveProjectContent(org.apache.maven.project.MavenProject p,
org.codehaus.plexus.archiver.Archiver archiver) |
protected org.apache.maven.archiver.MavenArchiver |
createArchiver() |
void |
execute() |
protected abstract java.lang.String |
getClassifier() |
private java.lang.String[] |
getCombinedExcludes(java.util.List<java.lang.String> additionalExcludes)
Combines the user parameter
excludes , the default excludes from plexus FileUtils, and the contents of
the parameter addionalExcludes. |
private java.lang.String[] |
getCombinedIncludes(java.util.List<java.lang.String> additionalIncludes)
Combines the includes parameter and additional includes.
|
protected java.lang.String |
getExtension() |
protected org.apache.maven.project.MavenProject |
getProject() |
protected org.apache.maven.project.MavenProject |
getProject(org.apache.maven.project.MavenProject p) |
protected abstract java.util.List<org.apache.maven.model.Resource> |
getResources(org.apache.maven.project.MavenProject p) |
protected abstract java.util.List<java.lang.String> |
getSources(org.apache.maven.project.MavenProject p) |
protected java.lang.String |
getType() |
protected void |
packageSources(java.util.List<org.apache.maven.project.MavenProject> theProjects) |
protected void |
packageSources(org.apache.maven.project.MavenProject p) |
protected void |
setProject(org.apache.maven.project.MavenProject project) |
private static final java.lang.String[] DEFAULT_INCLUDES
private static final java.lang.String[] DEFAULT_EXCLUDES
@Parameter private java.lang.String[] includes
@Parameter private java.lang.String[] excludes
@Parameter(property="maven.source.useDefaultExcludes", defaultValue="true") private boolean useDefaultExcludes
@Parameter(defaultValue="${project}", readonly=true, required=true) private org.apache.maven.project.MavenProject project
@Component(role=org.codehaus.plexus.archiver.Archiver.class, hint="jar") private org.codehaus.plexus.archiver.jar.JarArchiver jarArchiver
@Parameter private org.apache.maven.archiver.MavenArchiveConfiguration archive
@Parameter(defaultValue="${project.build.outputDirectory}/META-INF/MANIFEST.MF", readonly=false, required=true) private java.io.File defaultManifestFile
useDefaultManifestFile
is set to
true
.@Parameter(property="maven.source.useDefaultManifestFile", defaultValue="false") private boolean useDefaultManifestFile
true
to enable the use of the defaultManifestFile
. @Parameter(property="maven.source.attach", defaultValue="true") private boolean attach
@Parameter(property="maven.source.excludeResources", defaultValue="false") protected boolean excludeResources
@Parameter(property="maven.source.includePom", defaultValue="false") protected boolean includePom
@Component private org.apache.maven.project.MavenProjectHelper projectHelper
@Parameter(defaultValue="${project.build.directory}") protected java.io.File outputDirectory
@Parameter(defaultValue="${project.build.finalName}", readonly=true) protected java.lang.String finalName
@Parameter(defaultValue="${reactorProjects}", readonly=true) protected java.util.List<org.apache.maven.project.MavenProject> reactorProjects
@Parameter(property="maven.source.forceCreation", defaultValue="false") private boolean forceCreation
@Parameter(property="maven.source.skip", defaultValue="false") private boolean skipSource
@Parameter(defaultValue="${session}", readonly=true, required=true) private org.apache.maven.execution.MavenSession session
public void execute() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected abstract java.lang.String getClassifier()
sources
or test-sources
protected abstract java.util.List<java.lang.String> getSources(org.apache.maven.project.MavenProject p) throws org.apache.maven.plugin.MojoExecutionException
p
- MavenProject
not nullorg.apache.maven.plugin.MojoExecutionException
- in case of an error.protected abstract java.util.List<org.apache.maven.model.Resource> getResources(org.apache.maven.project.MavenProject p) throws org.apache.maven.plugin.MojoExecutionException
p
- MavenProject
not nullorg.apache.maven.plugin.MojoExecutionException
- in case of an error.protected void packageSources(org.apache.maven.project.MavenProject p) throws org.apache.maven.plugin.MojoExecutionException
p
- MavenProject
org.apache.maven.plugin.MojoExecutionException
- in case of an error.protected void packageSources(java.util.List<org.apache.maven.project.MavenProject> theProjects) throws org.apache.maven.plugin.MojoExecutionException
theProjects
- MavenProject
org.apache.maven.plugin.MojoExecutionException
- in case of an error.protected void archiveProjectContent(org.apache.maven.project.MavenProject p, org.codehaus.plexus.archiver.Archiver archiver) throws org.apache.maven.plugin.MojoExecutionException
p
- MavenProject
archiver
- Archiver
org.apache.maven.plugin.MojoExecutionException
- in case of an error.protected org.apache.maven.archiver.MavenArchiver createArchiver() throws org.apache.maven.plugin.MojoExecutionException
MavenArchiver
org.apache.maven.plugin.MojoExecutionException
- in case of an error.protected void addDirectory(org.codehaus.plexus.archiver.Archiver archiver, java.io.File sourceDirectory, java.lang.String[] pIncludes, java.lang.String[] pExcludes) throws org.apache.maven.plugin.MojoExecutionException
archiver
- Archiver
sourceDirectory
- File
pIncludes
- The list of includes.pExcludes
- The list of excludes.org.apache.maven.plugin.MojoExecutionException
- in case of an error.protected void addDirectory(org.codehaus.plexus.archiver.Archiver archiver, java.io.File sourceDirectory, java.lang.String prefix, java.lang.String[] pIncludes, java.lang.String[] pExcludes) throws org.apache.maven.plugin.MojoExecutionException
archiver
- Archiver
sourceDirectory
- File
prefix
- The prefix.pIncludes
- the includes.pExcludes
- the excludes.org.apache.maven.plugin.MojoExecutionException
- in case of an error.protected java.lang.String getExtension()
.jar
protected org.apache.maven.project.MavenProject getProject(org.apache.maven.project.MavenProject p)
p
- MavenProject
protected java.lang.String getType()
java-source
private java.lang.String[] getCombinedIncludes(java.util.List<java.lang.String> additionalIncludes)
DEFAULT_INCLUDES
If the
additionalIncludes parameter is null, it is not added to the combined includes.additionalIncludes
- The includes specified in the pom resources sectionprivate java.lang.String[] getCombinedExcludes(java.util.List<java.lang.String> additionalExcludes)
excludes
, the default excludes from plexus FileUtils, and the contents of
the parameter addionalExcludes.additionalExcludes
- Additional excludes to add to the arrayprotected org.apache.maven.project.MavenProject getProject()
protected void setProject(org.apache.maven.project.MavenProject project)
project
- MavenProject