org.apache.maven.plugins.site
Class AbstractDeployMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.maven.plugins.site.AbstractSiteMojo
          extended by org.apache.maven.plugins.site.AbstractDeployMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, Contextualizable
Direct Known Subclasses:
SiteDeployMojo, SiteStageDeployMojo, SiteStageMojo

public abstract class AbstractDeployMojo
extends AbstractSiteMojo
implements Contextualizable

Abstract base class for deploy mojos. Since 2.3 this includes SiteStageMojo and SiteStageDeployMojo.

Since:
2.3
Author:
ltheussl

Field Summary
protected static String DEFAULT_STAGING_DIRECTORY
          The String "staging/".
 
Fields inherited from class org.apache.maven.plugins.site.AbstractSiteMojo
i18n, locales, localRepository, project, reactorProjects, siteDirectory, siteTool
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractDeployMojo()
           
 
Method Summary
protected static String appendSlash(String url)
          Make sure the given url ends with a slash.
 void contextualize(Context context)
          
 void execute()
          
protected abstract  String getDeployRepositoryID()
          Specifies the id to look up credential settings.
protected abstract  String getDeployRepositoryURL()
          Specifies the target URL for the deploy.
static org.apache.maven.wagon.proxy.ProxyInfo getProxyInfo(org.apache.maven.wagon.repository.Repository repository, org.apache.maven.artifact.manager.WagonManager wagonManager)
           Get the ProxyInfo of the proxy associated with the host and the protocol of the given repository.
protected  org.apache.maven.model.Site getRootSite(org.apache.maven.project.MavenProject project)
          Extract the distributionManagment site of the top level parent of the given MavenProject.
protected static org.apache.maven.model.Site getSite(org.apache.maven.project.MavenProject project)
          Extract the distributionManagment site from the given MavenProject.
protected  File getTopLevelBuildDirectory()
          Find the build directory of the top level project in the reactor.
 
Methods inherited from class org.apache.maven.plugins.site.AbstractSiteMojo
checkMavenVersion, getInputEncoding, getMavenVersion, getOutputEncoding
 
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

DEFAULT_STAGING_DIRECTORY

protected static final String DEFAULT_STAGING_DIRECTORY
The String "staging/".

See Also:
Constant Field Values
Constructor Detail

AbstractDeployMojo

public AbstractDeployMojo()
Method Detail

execute

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

Specified by:
execute in interface org.apache.maven.plugin.Mojo
Throws:
org.apache.maven.plugin.MojoExecutionException

appendSlash

protected static String appendSlash(String url)
Make sure the given url ends with a slash.

Parameters:
url - a String.
Returns:
if url already ends with '/' it is returned unchanged, otherwise a '/' character is appended.

getDeployRepositoryID

protected abstract String getDeployRepositoryID()
                                         throws org.apache.maven.plugin.MojoExecutionException
Specifies the id to look up credential settings.

Returns:
the id to look up credentials for the deploy. Not null.
Throws:
org.apache.maven.plugin.MojoExecutionException - if the ID cannot be determined

getDeployRepositoryURL

protected abstract String getDeployRepositoryURL()
                                          throws org.apache.maven.plugin.MojoExecutionException
Specifies the target URL for the deploy. This should be the top-level URL, ie above modules and locale sub-directories.

Returns:
the url to deploy to. Not null.
Throws:
org.apache.maven.plugin.MojoExecutionException - if the URL cannot be constructed

getTopLevelBuildDirectory

protected File getTopLevelBuildDirectory()
Find the build directory of the top level project in the reactor. If no top level project is found, the build directory of the current project is returned.

Returns:
the build directory of the top level project.

getProxyInfo

public static org.apache.maven.wagon.proxy.ProxyInfo getProxyInfo(org.apache.maven.wagon.repository.Repository repository,
                                                                  org.apache.maven.artifact.manager.WagonManager wagonManager)

Get the ProxyInfo of the proxy associated with the host and the protocol of the given repository.

Extract from J2SE Doc : Networking Properties - nonProxyHosts : "The value can be a list of hosts, each separated by a |, and in addition a wildcard character (*) can be used for matching"

Defensively support for comma (",") and semi colon (";") in addition to pipe ("|") as separator.

Parameters:
repository - the Repository to extract the ProxyInfo from.
wagonManager - the WagonManager used to connect to the Repository.
Returns:
a ProxyInfo object instantiated or null if no matching proxy is found

contextualize

public void contextualize(Context context)
                   throws ContextException

Specified by:
contextualize in interface Contextualizable
Throws:
ContextException

getSite

protected static org.apache.maven.model.Site getSite(org.apache.maven.project.MavenProject project)
                                              throws org.apache.maven.plugin.MojoExecutionException
Extract the distributionManagment site from the given MavenProject.

Parameters:
project - the MavenProject. Not null.
Returns:
the project site. Not null. Also site.getUrl() and site.getId() are guaranteed to be not null.
Throws:
org.apache.maven.plugin.MojoExecutionException - if any of the site info is missing.

getRootSite

protected org.apache.maven.model.Site getRootSite(org.apache.maven.project.MavenProject project)
                                           throws org.apache.maven.plugin.MojoExecutionException
Extract the distributionManagment site of the top level parent of the given MavenProject. This climbs up the project hierarchy and returns the site of the last project for which getSite(org.apache.maven.project.MavenProject) returns a site.

Parameters:
project - the MavenProject. Not null.
Returns:
the top level site. Not null. Also site.getUrl() and site.getId() are guaranteed to be not null.
Throws:
org.apache.maven.plugin.MojoExecutionException - if no site info is found in the tree.


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