org.apache.maven.plugin.source
Class AbstractJarSourceMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.maven.plugin.source.AbstractJarSourceMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
JarDefaultSourceMojo, JarTestSourceMojo

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


Field Summary
protected  String finalName
          The filename to be used for the generated archive file.
protected  File outputDirectory
          The directory where the generated archive file will be put.
protected  String packaging
           
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractJarSourceMojo()
           
 
Method Summary
protected  File[] addDirectories(List compileSourceRoots, List resources, File[] sourceDirectories)
          Add the compile source directories and resource directories that will be included in the jar file
protected  void attachArtifact(File outputFile, String classifier)
          Method to attach generated artifact to artifact list
protected  org.codehaus.plexus.archiver.Archiver createArchiver()
           
protected  void createJar(File outputFile, File[] sourceDirectories, org.codehaus.plexus.archiver.Archiver archiver)
          Create jar file that contains the specified source directories
abstract  void execute()
           
protected  File[] getDefaultSources()
          Get the main sources that will be included in the jar file
 org.apache.maven.project.MavenProject getExecutedProject()
           
 String getPackaging()
           
 org.apache.maven.project.MavenProject getProject()
           
protected  File[] getTestSources()
          Get the test sources that will be included in the test sources jar file
protected  void makeSourceBundle(File outputFile, File[] sourceDirectories, org.codehaus.plexus.archiver.Archiver archiver)
          Method to create an archive of the specified files
 void setExecutedProject(org.apache.maven.project.MavenProject executedProject)
           
 void setPackaging(String packaging)
           
 void setProject(org.apache.maven.project.MavenProject project)
           
 
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

packaging

protected String packaging

outputDirectory

protected File outputDirectory
The directory where the generated archive file will be put. Defaults to ${project.build.directory} specified in the pom or inherited from the super pom.


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. Defaults to ${project.build.finalName} specified in the pom or inherited from the super pom.

Constructor Detail

AbstractJarSourceMojo

public AbstractJarSourceMojo()
Method Detail

execute

public abstract void execute()
                      throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException
See Also:
Mojo.execute()

getProject

public org.apache.maven.project.MavenProject getProject()

setProject

public void setProject(org.apache.maven.project.MavenProject project)

getPackaging

public String getPackaging()

setPackaging

public void setPackaging(String packaging)

getExecutedProject

public org.apache.maven.project.MavenProject getExecutedProject()

setExecutedProject

public void setExecutedProject(org.apache.maven.project.MavenProject executedProject)

addDirectories

protected File[] addDirectories(List compileSourceRoots,
                                List resources,
                                File[] sourceDirectories)
Add the compile source directories and resource directories that will be included in the jar file

Parameters:
compileSourceRoots -
resources -
sourceDirectories -
Returns:
an array of File objects that contains the directories that will be included in the jar file

getTestSources

protected File[] getTestSources()
Get the test sources that will be included in the test sources jar file

Returns:
an array of File objects that contains the test source directories

getDefaultSources

protected File[] getDefaultSources()
Get the main sources that will be included in the jar file

Returns:
an array of File objects that contains the source directories

createJar

protected void createJar(File outputFile,
                         File[] sourceDirectories,
                         org.codehaus.plexus.archiver.Archiver archiver)
                  throws IOException,
                         org.codehaus.plexus.archiver.ArchiverException
Create jar file that contains the specified source directories

Parameters:
outputFile - the file name of the jar
sourceDirectories - the source directories that will be included in the jar file
Throws:
IOException
org.codehaus.plexus.archiver.ArchiverException

attachArtifact

protected void attachArtifact(File outputFile,
                              String classifier)
Method to attach generated artifact to artifact list

Parameters:
outputFile - the artifact file to be attached
classifier -

makeSourceBundle

protected void makeSourceBundle(File outputFile,
                                File[] sourceDirectories,
                                org.codehaus.plexus.archiver.Archiver archiver)
                         throws org.codehaus.plexus.archiver.ArchiverException,
                                IOException
Method to create an archive of the specified files

Parameters:
outputFile - the destination file of the generated archive
sourceDirectories - the directory where the files to be archived are located
archiver - the archiver object that will create the archive
Throws:
org.codehaus.plexus.archiver.ArchiverException
IOException

createArchiver

protected org.codehaus.plexus.archiver.Archiver createArchiver()
                                                        throws org.codehaus.plexus.archiver.ArchiverException
Throws:
org.codehaus.plexus.archiver.ArchiverException


Copyright © 2002-2006 Apache Software Foundation. All Rights Reserved.