Repository: quarkusio/quarkus
Issue: devtools/cli generates quarkus-cli-999-SNAPSHOT.jar.original as directory and BuildMojo code can't handle it

devtools/cli generates quarkus-cli-999-SNAPSHOT.jar.original as directory and BuildMojo code can't handle it

To reproduce just call twice `mvn package -pl devtools/cli/ -DskipTests`. Important piece is that `clean` is not part of the command.

mvn command ends with:
```
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:999-SNAPSHOT:build (default) on project 
 quarkus-cli: Failed to build quarkus application: java.nio.file.DirectoryNotEmptyException: /Users/rsvoboda/tmp/
 quarkus/devtools/cli/target/quarkus-cli-999-SNAPSHOT.jar.original -> [Help 1]
```

Details from `mvn -X ...` execution
```
Caused by: java.nio.file.DirectoryNotEmptyException: /Users/rsvoboda/tmp/quarkus/devtools/cli/target/quarkus-cli-999-SNAPSHOT.jar.original
    at sun.nio.fs.UnixFileSystemProvider.implDelete (UnixFileSystemProvider.java:247)
    at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists (AbstractFileSystemProvider.java:110)
    at java.nio.file.Files.deleteIfExists (Files.java:1180)
    at io.quarkus.maven.BuildMojo.doExecute (BuildMojo.java:100)
    at io.quarkus.maven.QuarkusBootstrapMojo.execute (QuarkusBootstrapMojo.java:90)
...
```

Code in BuildMojo expects file, not directory like in devtools/cli case
```
$ find devtools/cli/target/quarkus-cli-999-SNAPSHOT.jar.original
devtools/cli/target/quarkus-cli-999-SNAPSHOT.jar.original
devtools/cli/target/quarkus-cli-999-SNAPSHOT.jar.original/io
devtools/cli/target/quarkus-cli-999-SNAPSHOT.jar.original/io/quarkus
devtools/cli/target/quarkus-cli-999-SNAPSHOT.jar.original/io/quarkus/cli
devtools/cli/target/quarkus-cli-999-SNAPSHOT.jar.original/io/quarkus/cli/Clean.class
devtools/cli/target/quarkus-cli-999-SNAPSHOT.jar.original/io/quarkus/cli/core
devtools/cli/target/quarkus-cli-999-SNAPSHOT.jar.original/io/quarkus/cli/core/QuarkusVersion.class
devtools/cli/target/quarkus-cli-999-SNAPSHOT.jar.original/io/quarkus/cli/core/BaseSubCommand.class
devtools/cli/target/quarkus-cli-999-SNAPSHOT.jar.original/io/quarkus/cli/core/BuildsystemCommand.class
devtools/cli/target/quarkus-cli-999-SNAPSHOT.jar.original/io/quarkus/cli/core/ExecuteUtil.class
devtools/cli/target/quarkus-cli-999-SNAPSHOT.jar.original/io/quarkus/cli/Remove.class
devtools/cli/target/quarkus-cli-999-SNAPSHOT.jar.original/io/quarkus/cli/Create$TargetLanguage.class
devtools/cli/target/quarkus-cli-999-SNAPSHOT.jar.original/io/quarkus/cli/List$ExtensionFormat.class
devtools/cli/target/quarkus-cli-999-SNAPSHOT.jar.original/io/quarkus/cli/QuarkusCli.class
devtools/cli/target/quarkus-cli-999-SNAPSHOT.jar.original/io/quarkus/cli/Add.class
devtools/cli/target/quarkus-cli-999-SNAPSHOT.jar.original/io/quarkus/cli/Dev.class
devtools/cli/target/quarkus-cli-999-SNAPSHOT.jar.original/io/quarkus/cli/List.class
devtools/cli/target/quarkus-cli-999-SNAPSHOT.jar.original/io/quarkus/cli/Build.class
devtools/cli/target/quarkus-cli-999-SNAPSHOT.jar.original/io/quarkus/cli/QuarkusCli$ExecutionStrategy.class
devtools/cli/target/quarkus-cli-999-SNAPSHOT.jar.original/io/quarkus/cli/Create.class
devtools/cli/target/quarkus-cli-999-SNAPSHOT.jar.original/io/quarkus/cli/Create$TargetBuildTool.class
devtools/cli/target/quarkus-cli-999-SNAPSHOT.jar.original/application.properties
```


Probably related to https://github.com/quarkusio/quarkus/pull/12725 changes, CI job started to fail 4 days ago

Changed files:
devtools/maven/src/main/java/io/quarkus/maven/BuildMojo.java

diff --git a/devtools/maven/src/main/java/io/quarkus/maven/BuildMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/BuildMojo.java
index 7dac05ea045..fade91e4779 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/BuildMojo.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/BuildMojo.java
@@ -20,6 +20,7 @@
 import io.quarkus.bootstrap.app.AugmentAction;
 import io.quarkus.bootstrap.app.AugmentResult;
 import io.quarkus.bootstrap.app.CuratedApplication;
+import io.quarkus.bootstrap.util.IoUtils;
 
 /**
  * Build the application.
@@ -97,7 +98,7 @@ protected void doExecute() throws MojoExecutionException {
                         final Path standardJar = curatedApplication.getAppModel().getAppArtifact().getPaths().getSinglePath();
                         if (Files.exists(standardJar)) {
                             try {
-                                Files.deleteIfExists(result.getJar().getOriginalArtifact());
+                                IoUtils.recursiveDelete(result.getJar().getOriginalArtifact());
                                 Files.move(standardJar, result.getJar().getOriginalArtifact());
                             } catch (IOException e) {
                                 throw new UncheckedIOException(e);