Skip to content

Commit

Permalink
Merge pull request #46 from TechnologyBrewery/45-fix-clean-plugin
Browse files Browse the repository at this point in the history
#45 🐛 update to also clean target in addition to dist
  • Loading branch information
d-ryan-ashcraft authored Sep 7, 2023
2 parents ff17267 + 5316ca4 commit ead26ad
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,21 @@ normal circumstances.

Default: `${project.basedir}/target/habushu.placeholder.txt`


#### distDirectory ####

Controls where the clean plugin will delete dist artifacts.

Default: `${project.basedir}/dist`


#### targetDirectory ####

Controls where the clean plugin will delete target artifacts.

Default: `${project.basedir}/target`


## The Habushu Build Lifecycle ##

Habushu applies a [custom Maven lifecycle that binds Poetry-based DevSecOps workflow commands](https://fermenter.atlassian.net/wiki/spaces/HAB/pages/2056749057/Dependency+Management+and+Build+Automation+through+Poetry+and+Maven) to the following phases:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ public class CleanHabushuMojo extends CleanMojo {
@Parameter(defaultValue = "${project.basedir}/dist", readonly = true, required = true)
protected File distDirectory;

/**
* Directory in which Maven places build-time artifacts - should NOT include dist items.
*/
@Parameter(defaultValue = "${project.basedir}/target", readonly = true, required = true)
protected File targetDirectory;

/**
* Enables the explicit deletion of the virtual environment that is
* created/managed by Poetry.
Expand Down Expand Up @@ -125,11 +131,15 @@ public void execute() throws MojoExecutionException {
try {
Fileset distArchivesFileset = createFileset(distDirectory);
filesetsToDelete.add(distArchivesFileset);

Fileset targetArchivesFileset = createFileset(targetDirectory);
filesetsToDelete.add(targetArchivesFileset);
} catch (IllegalAccessException e) {
throw new MojoExecutionException("Could not write to private field in Fileset class.", e);
}

getLog().info(String.format("Deleting distribution archives at %s", distDirectory));
getLog().info(String.format("Deleting target archives at %s", targetDirectory));

setPrivateParentField("filesets", filesetsToDelete.toArray(new Fileset[0]));
super.execute();
Expand Down

0 comments on commit ead26ad

Please sign in to comment.