com.atlassian.maven.plugins.aws.it.CleanerMojo Maven / Gradle / Ivy
package com.atlassian.maven.plugins.aws.it;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import java.io.File;
/**
* Cleans infrastructure provisioned by the provision-aws goal.
* Deletes all objects from all provisioned S3 buckets.
*/
@Mojo(name = "cleanup-aws", defaultPhase = LifecyclePhase.POST_INTEGRATION_TEST)
public class CleanerMojo extends AbstractMojo {
/**
* Pre-conditions
* It is the working directory of provision-aws goal.
*/
@Parameter(
defaultValue = "${project.build.directory}",
readonly = true
)
private File workingDirectory;
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
StackInfo stackInfo = new StackInfoProvider(workingDirectory).read();
Cleaner cleaner = new Cleaner(getLog());
cleaner.clean(stackInfo);
}
}