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

public abstract class AbstractDeployMojo extends AbstractSiteMojo
Abstract base class for deploy mojos. Since 2.3 this includes SiteStageMojo and SiteStageDeployMojo.
Since:
2.3
Author:
ltheussl
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.apache.maven.execution.MavenSession
     

    Fields inherited from class org.apache.maven.plugins.site.AbstractSiteMojo

    i18n, project, siteTool, skip

    Fields inherited from interface org.apache.maven.plugin.Mojo

    ROLE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected static String
    Make sure the given URL ends with a slash.
    protected abstract org.apache.maven.model.Site
     
    protected abstract String
     
    void
    org.apache.maven.wagon.authentication.AuthenticationInfo
     
    protected String
    Find the relative path between the distribution URLs of the top site and the current project.
    protected org.apache.maven.model.Site
    Get the site used for deployment, with its id to look up credential settings and the target URL for deploying.
    protected static org.apache.maven.model.Site
    getSite(org.apache.maven.project.MavenProject project)
    Extract the distributionManagement site from the given MavenProject.
    protected String
    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.
    protected abstract boolean
    Detect if the mojo is staging or deploying.

    Methods inherited from class org.apache.maven.plugins.site.AbstractSiteMojo

    getLocales

    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 Details

    • mavenSession

      @Parameter(defaultValue="${session}", readonly=true) protected org.apache.maven.execution.MavenSession mavenSession
      Since:
      3.0-beta-2
  • Constructor Details

    • AbstractDeployMojo

      public AbstractDeployMojo()
  • Method Details

    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException
      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.
    • isDeploy

      protected abstract boolean isDeploy()
      Detect if the mojo is staging or deploying.
      Returns:
      true if the mojo is for deploy and not staging (local or deploy)
    • getTopDistributionManagementSiteUrl

      protected String getTopDistributionManagementSiteUrl() throws org.apache.maven.plugin.MojoExecutionException
      Get 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.MojoExecutionException
      Get the site used for deployment, with its id to look up credential settings and the target URL for deploying. This should be a top-level URL, that is, above modules and locale subdirectories. 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

      protected String getDeployModuleDirectory() throws org.apache.maven.plugin.MojoExecutionException
      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
    • getAuthenticationInfo

      public org.apache.maven.wagon.authentication.AuthenticationInfo getAuthenticationInfo(String id)
    • 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.
    • 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 which 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.
      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.
      See Also:
      • URIPathDescriptor.sameSite(java.net.URI)