public abstract class AbstractDeployMojo extends AbstractSiteMojo implements org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
SiteStageMojo and SiteStageDeployMojo.| Modifier and Type | Class and Description |
|---|---|
private static class |
AbstractDeployMojo.URIEncoder |
| Modifier and Type | Field and Description |
|---|---|
private boolean |
chmod
Whether to run the "chmod" command on the remote site after the deploy.
|
private java.lang.String |
chmodMode
The mode used by the "chmod" command.
|
private java.lang.String |
chmodOptions
The options used by the "chmod" command.
|
private org.codehaus.plexus.PlexusContainer |
container |
private org.apache.maven.model.Site |
deploySite |
private java.io.File |
inputDirectory
Directory containing the generated project sites and report distributions.
|
protected org.apache.maven.execution.MavenSession |
mavenSession |
private org.apache.maven.settings.Settings |
settings
The current user system settings for use in Maven.
|
private boolean |
skipDeploy
Set this to 'true' to skip site deployment.
|
private java.lang.String |
topDistributionManagementSiteUrl |
private org.apache.maven.artifact.manager.WagonManager |
wagonManager |
i18n, localRepository, project, reactorProjects, siteTool, skip| Constructor and Description |
|---|
AbstractDeployMojo() |
| Modifier and Type | Method and Description |
|---|---|
protected static java.lang.String |
appendSlash(java.lang.String url)
Make sure the given url ends with a slash.
|
private static void |
chmod(org.apache.maven.wagon.Wagon wagon,
org.apache.maven.wagon.repository.Repository repository,
java.lang.String chmodOptions,
java.lang.String chmodMode) |
private static void |
configureWagon(org.apache.maven.wagon.Wagon wagon,
java.lang.String repositoryId,
org.apache.maven.settings.Settings settings,
org.codehaus.plexus.PlexusContainer container,
org.apache.maven.plugin.logging.Log log)
Configure the Wagon with the information from serverConfigurationMap ( which comes from settings.xml )
|
private static void |
configureWagonWithMaven2(org.codehaus.plexus.component.configurator.ComponentConfigurator componentConfigurator,
org.apache.maven.wagon.Wagon wagon,
org.codehaus.plexus.configuration.PlexusConfiguration plexusConf,
org.codehaus.plexus.PlexusContainer container) |
void |
contextualize(org.codehaus.plexus.context.Context context) |
private void |
deploy(java.io.File directory,
org.apache.maven.wagon.repository.Repository repository) |
private void |
deployTo(org.apache.maven.wagon.repository.Repository repository)
Use wagon to deploy the generated site to a given repository.
|
protected abstract org.apache.maven.model.Site |
determineDeploySite() |
protected abstract java.lang.String |
determineTopDistributionManagementSiteUrl() |
void |
execute() |
protected java.lang.String |
getDeployModuleDirectory()
Find the relative path between the distribution URLs of the top site and the current project.
|
protected org.apache.maven.model.Site |
getDeploySite()
Get the site used for deployment, with its id to look up credential settings and the target URL for the deploy.
|
private static java.lang.String |
getFullName(org.apache.maven.project.MavenProject project) |
private org.apache.maven.wagon.proxy.ProxyInfo |
getProxy(org.apache.maven.wagon.repository.Repository repository,
org.apache.maven.settings.crypto.SettingsDecrypter settingsDecrypter)
Get proxy information for Maven 3.
|
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 static org.apache.maven.model.Site |
getSite(org.apache.maven.project.MavenProject project)
Extract the distributionManagement site from the given MavenProject.
|
private java.lang.String |
getSupportedProtocols() |
protected java.lang.String |
getTopDistributionManagementSiteUrl()
Get the top distribution management site url, used for module relative path calculations.
|
protected org.apache.maven.project.MavenProject |
getTopLevelProject(org.apache.maven.project.MavenProject project)
Extract the distributionManagement site of the top level parent of the given MavenProject.
|
private org.apache.maven.wagon.Wagon |
getWagon(org.apache.maven.wagon.repository.Repository repository,
org.apache.maven.artifact.manager.WagonManager manager) |
protected abstract boolean |
isDeploy()
Detect if the mojo is staging or deploying.
|
private void |
push(java.io.File inputDirectory,
org.apache.maven.wagon.repository.Repository repository,
org.apache.maven.wagon.Wagon wagon,
org.apache.maven.wagon.proxy.ProxyInfo proxyInfo,
java.util.List<java.util.Locale> localesList,
java.lang.String relativeDir) |
getLocales, getMavenVersion, isMaven3OrMore@Parameter(alias="outputDirectory",
defaultValue="${project.reporting.outputDirectory}",
required=true)
private java.io.File inputDirectory
@Parameter(property="maven.site.chmod",
defaultValue="true")
private boolean chmod
@Parameter(property="maven.site.chmod.mode",
defaultValue="g+w,a+rX")
private java.lang.String chmodMode
@Parameter(property="maven.site.chmod.options",
defaultValue="-Rf")
private java.lang.String chmodOptions
@Parameter(property="maven.site.deploy.skip",
defaultValue="false")
private boolean skipDeploy
@Component private org.apache.maven.artifact.manager.WagonManager wagonManager
@Parameter(defaultValue="${settings}",
readonly=true)
private org.apache.maven.settings.Settings settings
@Parameter(defaultValue="${session}",
readonly=true)
protected org.apache.maven.execution.MavenSession mavenSession
private java.lang.String topDistributionManagementSiteUrl
private org.apache.maven.model.Site deploySite
private org.codehaus.plexus.PlexusContainer container
public void execute()
throws org.apache.maven.plugin.MojoExecutionException
execute in interface org.apache.maven.plugin.Mojoorg.apache.maven.plugin.MojoExecutionExceptionprotected static java.lang.String appendSlash(java.lang.String url)
url - a String.protected abstract boolean isDeploy()
true if the mojo is for deploy and not staging (local or deploy)protected java.lang.String getTopDistributionManagementSiteUrl()
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptiondetermineTopDistributionManagementSiteUrl()protected abstract java.lang.String determineTopDistributionManagementSiteUrl()
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptionprotected org.apache.maven.model.Site getDeploySite()
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptiondetermineDeploySite()protected abstract org.apache.maven.model.Site determineDeploySite()
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptionprotected java.lang.String getDeployModuleDirectory()
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptionprivate void deployTo(org.apache.maven.wagon.repository.Repository repository)
throws org.apache.maven.plugin.MojoExecutionException
repository - the repository to deploy to.
This needs to contain a valid, non-null id
to look up credentials for the deploy, and a valid, non-null
scm url to deploy to.org.apache.maven.plugin.MojoExecutionException - if the deploy fails.private void deploy(java.io.File directory,
org.apache.maven.wagon.repository.Repository repository)
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptionprivate org.apache.maven.wagon.Wagon getWagon(org.apache.maven.wagon.repository.Repository repository,
org.apache.maven.artifact.manager.WagonManager manager)
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptionprivate java.lang.String getSupportedProtocols()
private void push(java.io.File inputDirectory,
org.apache.maven.wagon.repository.Repository repository,
org.apache.maven.wagon.Wagon wagon,
org.apache.maven.wagon.proxy.ProxyInfo proxyInfo,
java.util.List<java.util.Locale> localesList,
java.lang.String relativeDir)
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptionprivate static void chmod(org.apache.maven.wagon.Wagon wagon,
org.apache.maven.wagon.repository.Repository repository,
java.lang.String chmodOptions,
java.lang.String chmodMode)
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptionpublic 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.
repository - the Repository to extract the ProxyInfo from.wagonManager - the WagonManager used to connect to the Repository.null if no matching proxy is foundprivate org.apache.maven.wagon.proxy.ProxyInfo getProxy(org.apache.maven.wagon.repository.Repository repository,
org.apache.maven.settings.crypto.SettingsDecrypter settingsDecrypter)
repository - settingsDecrypter - private static void configureWagon(org.apache.maven.wagon.Wagon wagon,
java.lang.String repositoryId,
org.apache.maven.settings.Settings settings,
org.codehaus.plexus.PlexusContainer container,
org.apache.maven.plugin.logging.Log log)
throws org.apache.maven.wagon.TransferFailedException
wagon - repositoryId - settings - container - log - org.apache.maven.wagon.TransferFailedExceptionprivate static void configureWagonWithMaven2(org.codehaus.plexus.component.configurator.ComponentConfigurator componentConfigurator,
org.apache.maven.wagon.Wagon wagon,
org.codehaus.plexus.configuration.PlexusConfiguration plexusConf,
org.codehaus.plexus.PlexusContainer container)
throws org.codehaus.plexus.component.configurator.ComponentConfigurationException
org.codehaus.plexus.component.configurator.ComponentConfigurationExceptionpublic void contextualize(org.codehaus.plexus.context.Context context)
throws org.codehaus.plexus.context.ContextException
contextualize in interface org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizableorg.codehaus.plexus.context.ContextExceptionprotected static org.apache.maven.model.Site getSite(org.apache.maven.project.MavenProject project)
throws org.apache.maven.plugin.MojoExecutionException
project - the MavenProject. Not null.org.apache.maven.plugin.MojoExecutionException - if any of the site info is missing.private static java.lang.String getFullName(org.apache.maven.project.MavenProject project)
protected org.apache.maven.project.MavenProject getTopLevelProject(org.apache.maven.project.MavenProject project)
throws org.apache.maven.plugin.MojoExecutionException
getSite(org.apache.maven.project.MavenProject) returns a site that resides in the
same site. Notice that it doesn't take into account if the parent is in the reactor or not.project - the MavenProject. Not null.null.
Also site.getUrl() and site.getId() are guaranteed to be not null.org.apache.maven.plugin.MojoExecutionException - if no site info is found in the tree.URIPathDescriptor.sameSite(java.net.URI)