Class AbstractDeployMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.maven.plugins.site.AbstractSiteMojo
org.apache.maven.plugins.site.deploy.AbstractDeployMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
AbstractStagingMojo, SiteDeployMojo
Abstract base class for deploy mojos.
Since 2.3 this includes
SiteStageMojo and SiteStageDeployMojo.- Since:
- 2.3
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanWhether to run the "chmod" command on the remote site after the deploy.private StringThe mode used by the "chmod" command.private StringThe options used by the "chmod" command.private org.codehaus.plexus.PlexusContainerprivate org.apache.maven.model.Siteprivate FileDirectory containing the generated project sites and report distributions.protected org.apache.maven.execution.MavenSessionprivate org.apache.maven.settings.SettingsThe current user system settings for use in Maven.(package private) org.apache.maven.settings.crypto.SettingsDecrypterprivate booleanSet this to 'true' to skip site deployment.private StringFields inherited from class AbstractSiteMojo
i18n, project, siteTool, skipFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static StringappendSlash(String url) Make sure the given URL ends with a slash.private static voidchmod(org.apache.maven.wagon.Wagon wagon, org.apache.maven.wagon.repository.Repository repository, String chmodOptions, String chmodMode) private voidprivate voiddeployTo(org.apache.maven.wagon.repository.Repository repository) Use wagon to deploy the generated site to a given repository.protected abstract org.apache.maven.model.Siteprotected abstract Stringvoidexecute()org.apache.maven.wagon.authentication.AuthenticationInfoprotected StringFind the relative path between the distribution URLs of the top site and the current project.protected org.apache.maven.model.SiteGet the site used for deployment, with its id to look up credential settings and the target URL for the deploy.private static StringgetFullName(org.apache.maven.project.MavenProject project) private org.apache.maven.wagon.proxy.ProxyInfogetProxy(org.apache.maven.wagon.repository.Repository repository, org.apache.maven.settings.crypto.SettingsDecrypter settingsDecrypter) Get proxy information.protected static org.apache.maven.model.SitegetSite(org.apache.maven.project.MavenProject project) Extract the distributionManagement site from the given MavenProject.protected StringGet the top distribution management site url, used for module relative path calculations.protected org.apache.maven.project.MavenProjectgetTopLevelProject(org.apache.maven.project.MavenProject project) Extract the distributionManagement site of the top level parent of the given MavenProject.private org.apache.maven.wagon.WagongetWagon(org.apache.maven.wagon.repository.Repository repository) protected abstract booleanisDeploy()Detect if the mojo is staging or deploying.private voidpush(File inputDirectory, org.apache.maven.wagon.repository.Repository repository, org.apache.maven.wagon.Wagon wagon, org.apache.maven.wagon.proxy.ProxyInfo proxyInfo, List<Locale> localesList, String relativeDir) Methods inherited from class AbstractSiteMojo
getLocalesMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
inputDirectory
@Parameter(alias="outputDirectory", defaultValue="${project.reporting.outputDirectory}", required=true) private File inputDirectoryDirectory containing the generated project sites and report distributions.- Since:
- 2.3
-
chmod
@Parameter(property="maven.site.chmod", defaultValue="true") private boolean chmodWhether to run the "chmod" command on the remote site after the deploy. Defaults to "true".- Since:
- 2.1
-
chmodMode
The mode used by the "chmod" command. Only used if chmod = true. Defaults to "g+w,a+rX".- Since:
- 2.1
-
chmodOptions
The options used by the "chmod" command. Only used if chmod = true. Defaults to "-Rf".- Since:
- 2.1
-
skipDeploy
@Parameter(property="maven.site.deploy.skip", defaultValue="false") private boolean skipDeploySet this to 'true' to skip site deployment.- Since:
- 3.0
-
settings
@Parameter(defaultValue="${settings}", readonly=true) private org.apache.maven.settings.Settings settingsThe current user system settings for use in Maven. -
mavenSession
@Parameter(defaultValue="${session}", readonly=true) protected org.apache.maven.execution.MavenSession mavenSession- Since:
- 3.0-beta-2
-
topDistributionManagementSiteUrl
-
deploySite
private org.apache.maven.model.Site deploySite -
container
@Component private org.codehaus.plexus.PlexusContainer container -
settingsDecrypter
@Component org.apache.maven.settings.crypto.SettingsDecrypter settingsDecrypter
-
-
Constructor Details
-
AbstractDeployMojo
public AbstractDeployMojo()
-
-
Method Details
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
appendSlash
-
isDeploy
protected abstract boolean isDeploy()Detect if the mojo is staging or deploying.- Returns:
trueif the mojo is for deploy and not staging (local or deploy)
-
getTopDistributionManagementSiteUrl
protected String getTopDistributionManagementSiteUrl() throws org.apache.maven.plugin.MojoExecutionExceptionGet the top distribution management site url, used for module relative path calculations. This should be a top-level URL, ie above modules and locale sub-directories. Each deploy mojo can tweak algorithm to determine this top site by implementing determineTopDistributionManagementSiteUrl().- Returns:
- the site for deployment
- Throws:
org.apache.maven.plugin.MojoExecutionException- in case of issue- See Also:
-
determineTopDistributionManagementSiteUrl
protected abstract String determineTopDistributionManagementSiteUrl() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getDeploySite
protected org.apache.maven.model.Site getDeploySite() throws org.apache.maven.plugin.MojoExecutionExceptionGet the site used for deployment, with its id to look up credential settings and the target URL for the deploy. This should be a top-level URL, ie above modules and locale sub-directories. Each deploy mojo can tweak algorithm to determine this deploy site by implementing determineDeploySite().- Returns:
- the site for deployment
- Throws:
org.apache.maven.plugin.MojoExecutionException- in case of issue- See Also:
-
determineDeploySite
protected abstract org.apache.maven.model.Site determineDeploySite() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getDeployModuleDirectory
Find the relative path between the distribution URLs of the top site and the current project.- Returns:
- the relative path or "./" if the two URLs are the same.
- Throws:
org.apache.maven.plugin.MojoExecutionException- in case of issue
-
deployTo
private void deployTo(org.apache.maven.wagon.repository.Repository repository) throws org.apache.maven.plugin.MojoExecutionException Use wagon to deploy the generated site to a given repository.- Parameters:
repository- the repository to deploy to. This needs to contain a valid, non-nullidto look up credentials for the deploy, and a valid, non-nullscm urlto deploy to.- Throws:
org.apache.maven.plugin.MojoExecutionException- if the deploy fails.
-
deploy
private void deploy(File directory, org.apache.maven.wagon.repository.Repository repository) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
getWagon
private org.apache.maven.wagon.Wagon getWagon(org.apache.maven.wagon.repository.Repository repository) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
getAuthenticationInfo
-
push
private void push(File inputDirectory, org.apache.maven.wagon.repository.Repository repository, org.apache.maven.wagon.Wagon wagon, org.apache.maven.wagon.proxy.ProxyInfo proxyInfo, List<Locale> localesList, String relativeDir) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
chmod
-
getProxy
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.- Parameters:
repository- the Repository to extract the ProxyInfo fromsettingsDecrypter- settings password decrypter- Returns:
- a ProxyInfo object instantiated or
nullif no matching proxy is found.
-
getSite
protected static org.apache.maven.model.Site getSite(org.apache.maven.project.MavenProject project) throws org.apache.maven.plugin.MojoExecutionException Extract the distributionManagement 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.
-
getFullName
-
getTopLevelProject
protected org.apache.maven.project.MavenProject getTopLevelProject(org.apache.maven.project.MavenProject project) throws org.apache.maven.plugin.MojoExecutionException Extract the distributionManagement 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 whichgetSite(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.- Parameters:
project- the MavenProject. Notnull.- Returns:
- the top level site. Not
null. Also site.getUrl() and site.getId() are guaranteed to be notnull. - Throws:
org.apache.maven.plugin.MojoExecutionException- if no site info is found in the tree.- See Also:
-