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
NOT SUPPORTED.
|
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.
|
protected 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 |
reactorProjects
Contains the full list of projects in the reactor.
|
protected org.apache.maven.execution.MavenSession |
session
The Maven Session Object
|
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[] includes,
java.lang.String[] excludes) |
protected void |
addDirectory(org.codehaus.plexus.archiver.Archiver archiver,
java.io.File sourceDirectory,
java.lang.String prefix,
java.lang.String[] includes,
java.lang.String[] excludes) |
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 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 additionalIncludes)
Combines the includes parameter and additional includes.
|
protected java.lang.String |
getExtension() |
protected org.apache.maven.project.MavenProject |
getProject(org.apache.maven.project.MavenProject p) |
protected abstract java.util.List |
getResources(org.apache.maven.project.MavenProject p) |
protected abstract java.util.List<org.apache.maven.model.Resource> |
getSources(org.apache.maven.project.MavenProject p) |
protected java.lang.String |
getType() |
protected abstract boolean |
isRelevantProject(org.apache.maven.project.MavenProject p) |
protected void |
packageSources(java.util.List<org.apache.maven.project.MavenProject> projects) |
protected void |
packageSources(org.apache.maven.project.MavenProject p) |
protected void |
updateSourceManifest(org.apache.maven.archiver.MavenArchiveConfiguration mavenArchiveConfiguration) |
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(defaultValue="true") private boolean useDefaultExcludes
@Parameter(property="project", readonly=true, required=true) protected org.apache.maven.project.MavenProject project
@Parameter(property="session", readonly=true) protected org.apache.maven.execution.MavenSession session
@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", required=true, readonly=true) private java.io.File defaultManifestFile
useDefaultManifestFile
is set to true
.@Parameter(defaultValue="false") private boolean useDefaultManifestFile
true
to enable the use of the defaultManifestFile
. @Parameter(property="attach", defaultValue="true") private boolean attach
@Parameter(property="source.excludeResources", defaultValue="false") protected boolean excludeResources
@Parameter(property="source.includePom", defaultValue="false") protected boolean includePom
@Component private org.apache.maven.project.MavenProjectHelper projectHelper
@Parameter(property="project.build.directory") protected java.io.File outputDirectory
@Parameter(property="project.build.finalName") protected java.lang.String finalName
@Parameter(property="reactorProjects", readonly=true) protected java.util.List reactorProjects
@Parameter(property="source.forceCreation", defaultValue="false") private boolean forceCreation
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<org.apache.maven.model.Resource> getSources(org.apache.maven.project.MavenProject p) throws org.apache.maven.plugin.MojoExecutionException
p
- not nullorg.apache.maven.plugin.MojoExecutionException
protected abstract java.util.List getResources(org.apache.maven.project.MavenProject p) throws org.apache.maven.plugin.MojoExecutionException
p
- not nullorg.apache.maven.plugin.MojoExecutionException
protected void packageSources(org.apache.maven.project.MavenProject p) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected abstract boolean isRelevantProject(org.apache.maven.project.MavenProject p)
protected void packageSources(java.util.List<org.apache.maven.project.MavenProject> projects) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected void updateSourceManifest(org.apache.maven.archiver.MavenArchiveConfiguration mavenArchiveConfiguration)
protected void archiveProjectContent(org.apache.maven.project.MavenProject p, org.codehaus.plexus.archiver.Archiver archiver) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected org.apache.maven.archiver.MavenArchiver createArchiver() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected void addDirectory(org.codehaus.plexus.archiver.Archiver archiver, java.io.File sourceDirectory, java.lang.String[] includes, java.lang.String[] excludes) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected void addDirectory(org.codehaus.plexus.archiver.Archiver archiver, java.io.File sourceDirectory, java.lang.String prefix, java.lang.String[] includes, java.lang.String[] excludes) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected java.lang.String getExtension()
protected org.apache.maven.project.MavenProject getProject(org.apache.maven.project.MavenProject p)
protected java.lang.String getType()
private java.lang.String[] getCombinedIncludes(java.util.List 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 additionalExcludes)
excludes
, the default excludes from plexus FileUtils, and
the contents of the parameter addionalExcludes.additionalExcludes
- Additional excludes to add to the array