use of com.itemis.maven.plugins.cdi.annotations.RollbackOnError in project unleash-maven-plugin by shillner.
the class InstallArtifacts method rollback.
@RollbackOnError
public void rollback() {
this.log.info("Rolling back local artifact installation due to a processing exception.");
Collection<org.apache.maven.artifact.Artifact> artifacts = Collections2.transform(this.installedArtifacts, AetherToMavenArtifact.INSTANCE);
for (org.apache.maven.artifact.Artifact artifact : artifacts) {
File localArtifact = new File(this.LocalRepository.getBasedir(), this.LocalRepository.pathOf(artifact));
File localArtifactDirectory = localArtifact.getParentFile();
try {
this.log.debug("\tDeleting locally installed artifact (parent directory): " + artifact);
FileUtils.deleteDirectory(localArtifactDirectory);
} catch (IOException e) {
// do not fail in order to ensure that the other executions can also be rolled-back
this.log.error("Error rolling back artifact installation. Could not delete locally installed artifact: " + artifact, e);
}
}
}
Aggregations