Class DeployMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.maven.plugins.deploy.AbstractDeployMojo
org.apache.maven.plugins.deploy.DeployMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="deploy", defaultPhase=DEPLOY, threadSafe=true) public class DeployMojo extends AbstractDeployMojo
Deploys an artifact to remote repository.
  • Field Details

    • ALT_LEGACY_REPO_SYNTAX_PATTERN

      private static final Pattern ALT_LEGACY_REPO_SYNTAX_PATTERN
    • ALT_REPO_SYNTAX_PATTERN

      private static final Pattern ALT_REPO_SYNTAX_PATTERN
    • project

      @Parameter(defaultValue="${project}", readonly=true, required=true) private org.apache.maven.project.MavenProject project
    • reactorProjects

      @Parameter(defaultValue="${reactorProjects}", required=true, readonly=true) private List<org.apache.maven.project.MavenProject> reactorProjects
    • pluginDescriptor

      @Parameter(defaultValue="${plugin}", required=true, readonly=true) private org.apache.maven.plugin.descriptor.PluginDescriptor pluginDescriptor
    • deployAtEnd

      @Parameter(defaultValue="false", property="deployAtEnd") private boolean deployAtEnd
      Whether every project should be deployed during its own deploy-phase or at the end of the multimodule build.

      Important: deployAtEnd defers deployment, it does not make the whole batch atomic. If a mid-batch failure occurs some repositories may have already received artifacts. Repositories that were fully published before the failure remain published; there is no automatic rollback.

      • Projects configured with deployAtEnd=false deploy immediately during their own deploy phase and cannot be recalled by a later build failure.
      Since:
      2.8
    • altDeploymentRepository

      @Parameter(property="altDeploymentRepository") private String altDeploymentRepository
      Specifies an alternative repository to which the project artifacts should be deployed (other than those specified in <distributionManagement>).
      Format: id::url
      id
      The id can be used to pick up the correct credentials from the settings.xml
      url
      The location of the repository
      Note: In version 2.x, the format was id::layout::url where layout could be default (ie. Maven 2) or legacy (ie. Maven 1), but since 3.0.0 the layout part has been removed because Maven 3 only supports Maven 2 repository layout.
    • altSnapshotDeploymentRepository

      @Parameter(property="altSnapshotDeploymentRepository") private String altSnapshotDeploymentRepository
      The alternative repository to use when the project has a snapshot version. Note: In version 2.x, the format was id::layout::url where layout could be default (ie. Maven 2) or legacy (ie. Maven 1), but since 3.0.0 the layout part has been removed because Maven 3 only supports Maven 2 repository layout.
      Since:
      2.8
      See Also:
    • altReleaseDeploymentRepository

      @Parameter(property="altReleaseDeploymentRepository") private String altReleaseDeploymentRepository
      The alternative repository to use when the project has a final version. Note: In version 2.x, the format was id::layout::url where layout could be default (ie. Maven 2) or legacy (ie. Maven 1), but since 3.0.0 the layout part has been removed because Maven 3 only supports Maven 2 repository layout.
      Since:
      2.8
      See Also:
    • skip

      @Parameter(property="maven.deploy.skip", defaultValue="false") private String skip
      Set this to 'true' to bypass artifact deploy Since since 3.0.0-M2 it's not anymore a real boolean as it can have more than 2 values:
      • true: will skip as usual
      • releases: will skip if current version of the project is a release
      • snapshots: will skip if current version of the project is a snapshot
      • values are matched case-insensitively; any other value fails the build (fail-closed: a typo in a publish-suppression control must not silently publish)
      Since:
      2.4
    • allowIncompleteProjects

      @Parameter(defaultValue="false", property="allowIncompleteProjects") private boolean allowIncompleteProjects
      Set this to true to allow incomplete project processing. By default, such projects are forbidden and Mojo will fail to process them. Incomplete project is a Maven Project that has any other packaging than "pom" and has no main artifact packaged. In the majority of cases, what user really wants here is a project with "pom" packaging and some classified artifact attached (typical example is some assembly being packaged and attached with classifier).
      Since:
      3.1.1
    • DEPLOY_AT_END_LOCK

      private static final Object DEPLOY_AT_END_LOCK
      Monitor for deployAtEnd state operations. All check-then-fire sequences on per-project state (putState, allProjectsMarked, deploy-batch trigger) must hold this lock so that exactly one thread fires the batch under -T.
    • DEPLOY_PROCESSED_MARKER

      private static final String DEPLOY_PROCESSED_MARKER
    • DEPLOY_ALT_RELEASE_DEPLOYMENT_REPOSITORY

      private static final String DEPLOY_ALT_RELEASE_DEPLOYMENT_REPOSITORY
    • DEPLOY_ALT_SNAPSHOT_DEPLOYMENT_REPOSITORY

      private static final String DEPLOY_ALT_SNAPSHOT_DEPLOYMENT_REPOSITORY
    • DEPLOY_ALT_DEPLOYMENT_REPOSITORY

      private static final String DEPLOY_ALT_DEPLOYMENT_REPOSITORY
    • PROJECTS_WITH_DEPLOY_KEY

      private static final String PROJECTS_WITH_DEPLOY_KEY
  • Constructor Details

    • DeployMojo

      @Inject protected DeployMojo(org.apache.maven.rtinfo.RuntimeInformation runtimeInformation, org.eclipse.aether.RepositorySystem repositorySystem)
  • Method Details

    • putState

      private void putState(DeployMojo.State state)
    • putPluginContextValue

      private void putPluginContextValue(String key, String value)
    • getPluginContextValue

      private String getPluginContextValue(Map<String,Object> pluginContext, String key)
    • getState

      private DeployMojo.State getState(Map<String,Object> pluginContext)
    • hasState

      private boolean hasState(org.apache.maven.project.MavenProject project)
    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
      org.apache.maven.plugin.MojoFailureException
    • deployAllAtOnce

      private void deployAllAtOnce(List<org.apache.maven.project.MavenProject> allProjectsUsingPlugin) throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • getProjectsWithDeployExecution

      private List<org.apache.maven.project.MavenProject> getProjectsWithDeployExecution()
      Returns the list of reactor projects that have a deploy execution, cached on first call. The list is invariant during a build and is stored in the first reactor project's plugin context to avoid recomputing it on every module invocation (O(N) total instead of O(N²)).
    • allProjectsMarked

      private boolean allProjectsMarked(List<org.apache.maven.project.MavenProject> allProjectsUsingPlugin)
    • getAllProjectsUsingPlugin

      private List<org.apache.maven.project.MavenProject> getAllProjectsUsingPlugin()
    • hasDeployExecution

      private boolean hasDeployExecution(org.apache.maven.project.MavenProject project)
    • hasExecution

      private boolean hasExecution(org.apache.maven.model.Plugin plugin)
    • processProject

      private void processProject(org.apache.maven.project.MavenProject project, org.eclipse.aether.deployment.DeployRequest request) throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • isFile

      private boolean isFile(File file)
    • getDeploymentRepository

      org.eclipse.aether.repository.RemoteRepository getDeploymentRepository(org.apache.maven.project.MavenProject project, String altSnapshotDeploymentRepository, String altReleaseDeploymentRepository, String altDeploymentRepository) throws org.apache.maven.plugin.MojoExecutionException
      Visible for testing.
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • parseSkipMode

      static DeployMojo.SkipMode parseSkipMode(String skip, String propertyName) throws org.apache.maven.plugin.MojoExecutionException
      Parses the skip parameter into a DeployMojo.SkipMode, fail-closed: unrecognised values are refused rather than silently treated as "false" (which would deploy when the operator intended to suppress).
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • redactUrlUserInfo

      static String redactUrlUserInfo(String text)
      Replaces any userinfo@ section in URLs embedded in the string with ***@.