org.apache.commons.release.plugin.mojos

## Class CommonsStagingCleanupMojo

- java.lang.Object
- - org.apache.maven.plugin.AbstractMojo
  - - org.apache.commons.release.plugin.mojos.CommonsStagingCleanupMojo

- All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

      @Mojo(name="clean-staging",
            defaultPhase=POST_CLEAN,
            threadSafe=true,
            aggregator=true)
      public class CommonsStagingCleanupMojo
      extends org.apache.maven.plugin.AbstractMojo

  This class checks out the dev distribution location, checkes whether anything exists in the distribution location, and if it is non-empty it deletes all of the resources there.
  Since:
    1.6
  Author:
    chtompki

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private File` | `distCleanupDirectory` The location to which to checkout the dist subversion repository under our working directory, which was given above.
    `private String` | `distServer` The ID of the server (specified in settings.xml) which should be used for dist authentication.
    `private String` | `distSvnStagingUrl` The url of the subversion repository to which we wish the artifacts to be staged.
    `private Boolean` | `dryRun` A boolean that determines whether or not we actually commit the files up to the subversion repository.
    `private Boolean` | `isDistModule` A parameter to generally avoid running unless it is specifically turned on by the consuming module.
    `private String` | `password` The password associated with `CommonsDistributionStagingMojo.username`.
    `private org.apache.maven.project.MavenProject` | `project` The `MavenProject` object is essentially the context of the maven build at a given time.
    `private org.apache.maven.settings.Settings` | `settings` Maven `Settings`.
    `private org.apache.maven.settings.crypto.SettingsDecrypter` | `settingsDecrypter` Maven `SettingsDecrypter` component.
    `private String` | `username` The username for the distribution subversion repository.
    `private File` | `workingDirectory` The main working directory for the plugin, namely `target/commons-release-plugin`, but that assumes that we're using the default maven `${project.build.directory}`.

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

      `ROLE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CommonsStagingCleanupMojo()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `execute()`

    - ### 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

    - #### project

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

      The `MavenProject` object is essentially the context of the maven build at a given time.

    - #### workingDirectory

          @Parameter(defaultValue="${project.build.directory}/commons-release-plugin",
                     property="commons.outputDirectory")
          private File workingDirectory

      The main working directory for the plugin, namely `target/commons-release-plugin`, but that assumes that we're using the default maven `${project.build.directory}`.

    - #### distCleanupDirectory

          @Parameter(defaultValue="${project.build.directory}/commons-release-plugin/scm-cleanup",
                     property="commons.distCleanupDirectory")
          private File distCleanupDirectory

      The location to which to checkout the dist subversion repository under our working directory, which was given above. We then do an SVN delete on all of the directories in this repository.

    - #### dryRun

          @Parameter(property="commons.release.dryRun",
                     defaultValue="false")
          private Boolean dryRun

      A boolean that determines whether or not we actually commit the files up to the subversion repository. If this is set to `true`, we do all but make the commits. We do checkout the repository in question though.

    - #### distSvnStagingUrl

          @Parameter(defaultValue="",
                     property="commons.distSvnStagingUrl")
          private String distSvnStagingUrl

      The url of the subversion repository to which we wish the artifacts to be staged. Typically this would need to be of the form: `scm:svn:https://dist.apache.org/repos/dist/dev/commons/foo/version-RC#`. Note. that the prefix to the substring `https` is a requirement.

    - #### isDistModule

          @Parameter(defaultValue="false",
                     property="commons.release.isDistModule")
          private Boolean isDistModule

      A parameter to generally avoid running unless it is specifically turned on by the consuming module.

    - #### distServer

          @Parameter(property="commons.distServer")
          private String distServer

      The ID of the server (specified in settings.xml) which should be used for dist authentication. This will be used in preference to `username`/`password`.

    - #### username

          @Parameter(property="user.name")
          private String username

      The username for the distribution subversion repository. This is typically your Apache id.

    - #### password

          @Parameter(property="user.password")
          private String password

      The password associated with `CommonsDistributionStagingMojo.username`.

    - #### settings

          @Parameter(defaultValue="${settings}",
                     readonly=true,
                     required=true)
          private org.apache.maven.settings.Settings settings

      Maven `Settings`.

    - #### settingsDecrypter

          @Component
          private org.apache.maven.settings.crypto.SettingsDecrypter settingsDecrypter

      Maven `SettingsDecrypter` component.

  - ### Constructor Detail

    - #### CommonsStagingCleanupMojo

          public CommonsStagingCleanupMojo()

  - ### Method Detail

    - #### 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`

Copyright © 2018–2022 The Apache Software Foundation. All rights reserved.