org.apache.maven.plugin.source
Class AbstractSourceJarMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.maven.plugin.source.AbstractSourceJarMojo
All Implemented Interfaces:
ContextEnabled, Mojo
Direct Known Subclasses:
SourceJarNoForkMojo, TestSourceJarNoForkMojo

public abstract class AbstractSourceJarMojo
extends AbstractMojo

Base class for bundling sources into a jar archive.

Since:
2.0.3
Version:
$Id: AbstractSourceJarMojo.java 1356885 2012-07-03 19:39:07Z olamy $

Field Summary
protected  boolean excludeResources
          Specifies whether or not to exclude resources from the sources-jar.
protected  String finalName
          The filename to be used for the generated archive file.
protected  boolean includePom
          Specifies whether or not to include the POM file in the sources-jar.
protected  File outputDirectory
          The directory where the generated archive file will be put.
protected  MavenProject project
          The Maven Project Object
protected  List reactorProjects
          Contains the full list of projects in the reactor.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractSourceJarMojo()
           
 
Method Summary
protected  void addDirectory(org.codehaus.plexus.archiver.Archiver archiver, File sourceDirectory, String[] includes, String[] excludes)
           
protected  void addDirectory(org.codehaus.plexus.archiver.Archiver archiver, File sourceDirectory, String prefix, String[] includes, String[] excludes)
           
protected  void archiveProjectContent(MavenProject p, org.codehaus.plexus.archiver.Archiver archiver)
           
protected  MavenArchiver createArchiver()
           
 void execute()
          
protected abstract  String getClassifier()
           
protected  String getExtension()
           
protected  MavenProject getProject(MavenProject p)
           
protected abstract  List<Resource> getResources(MavenProject p)
           
protected abstract  List<String> getSources(MavenProject p)
           
protected  String getType()
           
protected  void packageSources(List<MavenProject> projects)
           
protected  void packageSources(MavenProject p)
           
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

project

@Parameter(defaultValue="${project}",
           readonly=true,
           required=true)
protected MavenProject project
The Maven Project Object


excludeResources

@Parameter(property="source.excludeResources",
           defaultValue="false")
protected boolean excludeResources
Specifies whether or not to exclude resources from the sources-jar. This can be convenient if your project includes large resources, such as images, and you don't want to include them in the sources-jar.

Since:
2.0.4

includePom

@Parameter(property="source.includePom",
           defaultValue="false")
protected boolean includePom
Specifies whether or not to include the POM file in the sources-jar.

Since:
2.1

outputDirectory

@Parameter(defaultValue="${project.build.directory}")
protected File outputDirectory
The directory where the generated archive file will be put.


finalName

@Parameter(defaultValue="${project.build.finalName}")
protected String finalName
The filename to be used for the generated archive file. For the source:jar goal, "-sources" is appended to this filename. For the source:test-jar goal, "-test-sources" is appended.


reactorProjects

@Parameter(defaultValue="${reactorProjects}",
           readonly=true)
protected List reactorProjects
Contains the full list of projects in the reactor.

Constructor Detail

AbstractSourceJarMojo

public AbstractSourceJarMojo()
Method Detail

execute

public void execute()
             throws MojoExecutionException

Throws:
MojoExecutionException

getClassifier

protected abstract String getClassifier()
Returns:
the wanted classifier, ie sources or test-sources

getSources

protected abstract List<String> getSources(MavenProject p)
                                    throws MojoExecutionException
Parameters:
p - not null
Returns:
the compile or test sources
Throws:
MojoExecutionException

getResources

protected abstract List<Resource> getResources(MavenProject p)
                                        throws MojoExecutionException
Parameters:
p - not null
Returns:
the compile or test resources
Throws:
MojoExecutionException

packageSources

protected void packageSources(MavenProject p)
                       throws MojoExecutionException
Throws:
MojoExecutionException

packageSources

protected void packageSources(List<MavenProject> projects)
                       throws MojoExecutionException
Throws:
MojoExecutionException

archiveProjectContent

protected void archiveProjectContent(MavenProject p,
                                     org.codehaus.plexus.archiver.Archiver archiver)
                              throws MojoExecutionException
Throws:
MojoExecutionException

createArchiver

protected MavenArchiver createArchiver()
                                throws MojoExecutionException
Throws:
MojoExecutionException

addDirectory

protected void addDirectory(org.codehaus.plexus.archiver.Archiver archiver,
                            File sourceDirectory,
                            String[] includes,
                            String[] excludes)
                     throws MojoExecutionException
Throws:
MojoExecutionException

addDirectory

protected void addDirectory(org.codehaus.plexus.archiver.Archiver archiver,
                            File sourceDirectory,
                            String prefix,
                            String[] includes,
                            String[] excludes)
                     throws MojoExecutionException
Throws:
MojoExecutionException

getExtension

protected String getExtension()

getProject

protected MavenProject getProject(MavenProject p)

getType

protected String getType()


Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.