eo
eo copied to clipboard
eo-maven-plugin:clean
Let's add a new goal to our Maven plugin: clean
. It should simply delete the directory target/eo
(which is configurable through Maven property) and report about it in the log.
@Graur please, take care of this
@includealex please, take this task
@includealex First you need to create a new Mojo, let's call it CleanMojo
. Then pay attention to how ResolveMojo
class store files in target/eo
directory. Then implement in you new CleanMojo
deleting of this directory (maybe also UnplaceMojo
help you with this). And finally, place this new goal in AssembleMojo
@Graur sure.
@l3r8yJ Can you help us here?
@Graur yeah
@Graur
@Mojo(
name = "clean",
defaultPhase = LifecyclePhase.CLEAN,
threadSafe = true
)
public class CleanMojo extends SafeMojo {
@Override
void exec() throws IOException {
try (Stream<Path> paths = Files.walk(this.targetDir.toPath())) {
paths
.sorted(Comparator.reverseOrder())
.map(Path::toFile)
.forEach(File::delete);
}
}
}
can i use try with resource in this way?
@l3r8yJ Sure
@Graur what should I write in the javadoc tag @since x.x.x
instead of x.x.x
?
@l3r8yJ The next EO version
@Graur 0.28.6, right?
@l3r8yJ Yep, 0.28.6
@Graur In AssembleMojo
i should put my CleanMojo
to
final Moja<?>[] mojas = {
new Moja<>(ParseMojo.class),
new Moja<>(OptimizeMojo.class),
new Moja<>(DiscoverMojo.class),
new Moja<>(PullMojo.class),
new Moja<>(ResolveMojo.class),
new Moja<>(MarkMojo.class),
new Moja<>(PlaceMojo.class),
new Moja<>(CleanMojo.class), // here or we got mojo which turns on after we have built and tested?
};
@l3r8yJ Maybe we don't need to put it in AssembleMojo
. We can make this CleanMojo
as optional configuration.
@yegor256 What do you think?
@yegor256 @Graur eo:clean
should be a standalone command, a very simple one, just deleting eo/target
. It has nothing to do with other commands.
@yegor256 got you
@yegor256 @Graur do we have more separate plugin commands so I can see an example of how to make it?
UPD: found in qulice
irrelevant now.