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:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
SourceJarNoForkMojo, TestSourceJarNoForkMojo

public abstract class AbstractSourceJarMojo
extends org.apache.maven.plugin.AbstractMojo

Base class for bundling sources into a jar archive.

Since:
2.0.3
Version:
$Id: AbstractSourceJarMojo.java 763422 2009-04-08 21:59:54Z pgier $

Field Summary
protected  boolean excludeResources
          Specifies whether or not to exclude resources from the sources-jar.
protected  java.lang.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  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
protected  java.util.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, 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()
           
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 getSources(org.apache.maven.project.MavenProject p)
           
protected  java.lang.String getType()
           
protected  void packageSources(java.util.List projects)
           
protected  void packageSources(org.apache.maven.project.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

protected org.apache.maven.project.MavenProject project
The Maven Project Object

Is defined by:
expression:
${project}
Is readonly.
Is required.

excludeResources

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
Is defined by:
expression:
${source.excludeResources}
default-value:
false

includePom

protected boolean includePom
Specifies whether or not to include the POM file in the sources-jar.

Since:
2.1
Is defined by:
expression:
${source.includePom}
default-value:
false

outputDirectory

protected java.io.File outputDirectory
The directory where the generated archive file will be put.

Is defined by:
default-value:
${project.build.directory}

finalName

protected java.lang.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.

Is defined by:
default-value:
${project.build.finalName}

reactorProjects

protected java.util.List reactorProjects
Contains the full list of projects in the reactor.

Is defined by:
expression:
${reactorProjects}
Is readonly.
Constructor Detail

AbstractSourceJarMojo

public AbstractSourceJarMojo()
Method Detail

execute

public void execute()
             throws org.apache.maven.plugin.MojoExecutionException

Throws:
org.apache.maven.plugin.MojoExecutionException

getClassifier

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

getSources

protected abstract java.util.List getSources(org.apache.maven.project.MavenProject p)
                                      throws org.apache.maven.plugin.MojoExecutionException
Parameters:
p - not null
Returns:
the compile or test sources
Throws:
org.apache.maven.plugin.MojoExecutionException

getResources

protected abstract java.util.List getResources(org.apache.maven.project.MavenProject p)
                                        throws org.apache.maven.plugin.MojoExecutionException
Parameters:
p - not null
Returns:
the compile or test resources
Throws:
org.apache.maven.plugin.MojoExecutionException

packageSources

protected void packageSources(org.apache.maven.project.MavenProject p)
                       throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

packageSources

protected void packageSources(java.util.List projects)
                       throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

archiveProjectContent

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

createArchiver

protected org.apache.maven.archiver.MavenArchiver createArchiver()
                                                          throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

addDirectory

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
Throws:
org.apache.maven.plugin.MojoExecutionException

addDirectory

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
Throws:
org.apache.maven.plugin.MojoExecutionException

getExtension

protected java.lang.String getExtension()

getProject

protected org.apache.maven.project.MavenProject getProject(org.apache.maven.project.MavenProject p)

getType

protected java.lang.String getType()


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