diff --git a/src/main/java/ch/ivyteam/ivy/maven/AbstractEngineMojo.java b/src/main/java/ch/ivyteam/ivy/maven/AbstractEngineMojo.java index c0bce918..136e084d 100644 --- a/src/main/java/ch/ivyteam/ivy/maven/AbstractEngineMojo.java +++ b/src/main/java/ch/ivyteam/ivy/maven/AbstractEngineMojo.java @@ -136,7 +136,7 @@ protected final File findMatchingEngineInCacheDirectory() throws MojoExecutionEx protected final ArtifactVersion getInstalledEngineVersion(File engineDir) throws MojoExecutionException { try { - return new EngineVersionEvaluator(getLog(), engineDir).evaluateVersion(); + return new EngineVersionEvaluator(getLog(), engineDir.toPath()).evaluateVersion(); } catch (Exception ex) { throw new MojoExecutionException("Cannot evaluate engine version", ex); } diff --git a/src/main/java/ch/ivyteam/ivy/maven/InstallEngineMojo.java b/src/main/java/ch/ivyteam/ivy/maven/InstallEngineMojo.java index 64e80dfc..8327d4c5 100644 --- a/src/main/java/ch/ivyteam/ivy/maven/InstallEngineMojo.java +++ b/src/main/java/ch/ivyteam/ivy/maven/InstallEngineMojo.java @@ -19,6 +19,8 @@ import java.io.File; import java.io.IOException; import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -187,7 +189,7 @@ private void downloadAndInstallEngine(boolean cleanEngineDir) throws MojoExecuti if (autoInstallEngine) { getLog().info("Will automatically download Engine now."); final EngineDownloader engineDownloader = getDownloader(); - File downloadZip = engineDownloader.downloadEngine(); + var downloadZip = engineDownloader.downloadEngine(); if (cleanEngineDir) { removeOldEngineContent(); @@ -202,7 +204,11 @@ private void downloadAndInstallEngine(boolean cleanEngineDir) throws MojoExecuti unpackEngine(downloadZip); if (!downloadUsingMaven) { - downloadZip.delete(); + try { + Files.delete(downloadZip); + } catch (IOException ex) { + throw new MojoExecutionException("Could not delete file " + downloadZip.toAbsolutePath(), ex); + } } ArtifactVersion installedEngineVersion = getInstalledEngineVersion(getRawEngineDirectory()); @@ -231,7 +237,7 @@ public EngineDownloader getDownloader() throws MojoExecutionException { @SuppressWarnings("deprecation") ProxyInfoProvider proxies = wagonManager::getProxy; return new URLEngineDownloader(engineDownloadUrl, engineListPageUrl, osArchitecture, ivyVersion, - getIvyVersionRange(), getLog(), getDownloadDirectory(), proxies); + getIvyVersionRange(), getLog(), getDownloadDirectory().toPath(), proxies); } static String ivyEngineVersionOfZip(String engineZipFileName) { @@ -258,10 +264,10 @@ private boolean engineDirectoryIsEmpty() { return !getRawEngineDirectory().isDirectory() || ArrayUtils.isEmpty(getRawEngineDirectory().listFiles()); } - private void unpackEngine(File downloadZip) throws MojoExecutionException { + private void unpackEngine(Path downloadZip) throws MojoExecutionException { String targetLocation = getRawEngineDirectory().getAbsolutePath(); - getLog().info("Unpacking engine " + downloadZip.getAbsolutePath() + " to " + targetLocation); - try (var engineZip = new ZipFile(downloadZip)) { + getLog().info("Unpacking engine " + downloadZip.toAbsolutePath() + " to " + targetLocation); + try (var engineZip = new ZipFile(downloadZip.toFile())) { engineZip.extractAll(targetLocation); } catch (IOException ex) { throw new MojoExecutionException("Failed to unpack downloaded engine '" + downloadZip + "'.", ex); @@ -271,5 +277,4 @@ private void unpackEngine(File downloadZip) throws MojoExecutionException { File getDownloadDirectory() { return SystemUtils.getJavaIoTmpDir(); } - } diff --git a/src/main/java/ch/ivyteam/ivy/maven/MavenDependencyMojo.java b/src/main/java/ch/ivyteam/ivy/maven/MavenDependencyMojo.java index c8d84aa1..65f78ad3 100644 --- a/src/main/java/ch/ivyteam/ivy/maven/MavenDependencyMojo.java +++ b/src/main/java/ch/ivyteam/ivy/maven/MavenDependencyMojo.java @@ -16,7 +16,6 @@ package ch.ivyteam.ivy.maven; -import java.io.File; import java.io.IOException; import java.nio.file.FileAlreadyExistsException; import java.nio.file.Files; @@ -35,7 +34,7 @@ /** * Copy maven * dependencies to a specific folder. - * + * *

* To reduce the size of your ivy archives, make sure that your dependencies are * configured correctly: @@ -45,7 +44,7 @@ *

  • Exclude transient * dependencies which are already delivered by the core
  • * - * + * * @since 9.2.0 */ @Mojo(name = MavenDependencyMojo.GOAL, requiresDependencyResolution = ResolutionScope.COMPILE) @@ -79,15 +78,15 @@ protected void engineExec(MavenProjectBuilderProxy projectBuilder) throws Except getLog().info("Maven dependecies: " + copied + " copied."); } - private int copyDependency(Path mvnLibDir, List deps) { + private int copyDependency(Path mvnLibDir, List deps) { var count = 0; for (var dep : deps) { try { - Files.copy(dep.toPath(), mvnLibDir.resolve(dep.getName())); - getLog().debug("Copied dependency: " + dep.getName()); + Files.copy(dep, mvnLibDir.resolve(dep.getFileName().toString())); + getLog().debug("Copied dependency: " + dep.getFileName()); count++; } catch (FileAlreadyExistsException ex) { - getLog().debug("Ignore dependecy '" + dep.getName() + "' as it already exists at: " + mvnLibDir); + getLog().debug("Ignore dependecy '" + dep.getFileName() + "' as it already exists at: " + mvnLibDir); } catch (IOException ex) { getLog().warn("Couldn't copy depedency '" + deps + "' to: " + mvnLibDir, ex); } diff --git a/src/main/java/ch/ivyteam/ivy/maven/compile/AbstractProjectCompileMojo.java b/src/main/java/ch/ivyteam/ivy/maven/compile/AbstractProjectCompileMojo.java index 6fef6b4e..afa30f3e 100644 --- a/src/main/java/ch/ivyteam/ivy/maven/compile/AbstractProjectCompileMojo.java +++ b/src/main/java/ch/ivyteam/ivy/maven/compile/AbstractProjectCompileMojo.java @@ -18,6 +18,7 @@ import java.io.File; import java.nio.charset.Charset; +import java.nio.file.Path; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -88,6 +89,7 @@ protected Map getOptions() { private String getDependencyClasspath() { return StringUtils.join(getDependencies("jar").stream() + .map(Path::toFile) .map(jar -> jar.getAbsolutePath()) .collect(Collectors.toList()), File.pathSeparatorChar); } @@ -102,7 +104,7 @@ private File getCompilerSettings() { return null; } - protected final List getDependencies(String type) { + protected final List getDependencies(String type) { return MavenRuntime.getDependencies(project, type); } diff --git a/src/main/java/ch/ivyteam/ivy/maven/compile/CompileProjectMojo.java b/src/main/java/ch/ivyteam/ivy/maven/compile/CompileProjectMojo.java index 6eaab398..c7d2adf2 100644 --- a/src/main/java/ch/ivyteam/ivy/maven/compile/CompileProjectMojo.java +++ b/src/main/java/ch/ivyteam/ivy/maven/compile/CompileProjectMojo.java @@ -18,9 +18,10 @@ import java.io.File; import java.io.IOException; +import java.nio.file.Path; import java.util.Collection; -import java.util.List; import java.util.Map; +import java.util.stream.Collectors; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -32,7 +33,7 @@ /** * Compiles an ivy Project with an ivyEngine. - * + * * @author Reguel Wermelinger * @since 6.0.0 */ @@ -64,8 +65,8 @@ protected void engineExec(MavenProjectBuilderProxy projectBuilder) throws Except } getLog().info("Compiling ivy Project..."); - List iarDependencies = getDependencies("iar"); - List iarJars = projectBuilder.createIarJars(iarDependencies); + var iarDependencies = getDependencies("iar").stream().map(Path::toFile).collect(Collectors.toList()); + var iarJars = projectBuilder.createIarJars(iarDependencies); Map options = getOptions(); projectBuilder.compile(project.getBasedir(), iarJars, options); @@ -82,7 +83,7 @@ private void writeDependencyIarJar(Collection iarJarDepenencies) throws IO if (iarJarDepenencies == null) { // no dependencies return; } - File jar = new SharedFile(project).getIarDependencyClasspathJar(); + var jar = new SharedFile(project).getIarDependencyClasspathJar().toFile(); new ClasspathJar(jar).createFileEntries(iarJarDepenencies); } diff --git a/src/main/java/ch/ivyteam/ivy/maven/compile/CompileTestProjectMojo.java b/src/main/java/ch/ivyteam/ivy/maven/compile/CompileTestProjectMojo.java index 4e52119d..7b102e9b 100644 --- a/src/main/java/ch/ivyteam/ivy/maven/compile/CompileTestProjectMojo.java +++ b/src/main/java/ch/ivyteam/ivy/maven/compile/CompileTestProjectMojo.java @@ -32,7 +32,7 @@ /** * Compiles the test sources. - * + * * @author Reguel Wermelinger * @since 6.1.0 */ @@ -60,7 +60,7 @@ protected void engineExec(MavenProjectBuilderProxy projectBuilder) throws Except * @return persistent IAR-JARs from {@link CompileProjectMojo}. */ private List getDependencyIarJars() { - File iarJarClasspath = new SharedFile(project).getIarDependencyClasspathJar(); + var iarJarClasspath = new SharedFile(project).getIarDependencyClasspathJar().toFile(); if (!iarJarClasspath.exists()) { return Collections.emptyList(); } diff --git a/src/main/java/ch/ivyteam/ivy/maven/deploy/AbstractDeployMojo.java b/src/main/java/ch/ivyteam/ivy/maven/deploy/AbstractDeployMojo.java index f8c79f7d..5630f1da 100644 --- a/src/main/java/ch/ivyteam/ivy/maven/deploy/AbstractDeployMojo.java +++ b/src/main/java/ch/ivyteam/ivy/maven/deploy/AbstractDeployMojo.java @@ -18,6 +18,8 @@ import java.io.File; import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; import java.nio.file.ReadOnlyFileSystemException; import org.apache.commons.io.FileUtils; @@ -46,7 +48,7 @@ public abstract class AbstractDeployMojo extends AbstractIntegrationTestMojo { * from the {@link IarPackagingMojo#GOAL} is used. */ @Parameter(property = PROPERTY_IVY_DEPLOY_FILE, defaultValue = "${project.build.directory}/${project.artifactId}-${project.version}.iar") - protected File deployFile; + protected Path deployFile; /** * If set to true then test users defined in the projects are @@ -151,7 +153,7 @@ public abstract class AbstractDeployMojo extends AbstractIntegrationTestMojo { *

    * * Example options file content: - * + * *
        * deployTestUsers: auto
        *target:
    @@ -163,7 +165,7 @@ public abstract class AbstractDeployMojo extends AbstractIntegrationTestMojo {
        * Inside the options file you can use property placeholders. The options file
        * may look like this:
        * 

    - * + * *
        * deployTestUsers: ${ivy.deploy.test.users}
        *target:
    @@ -185,7 +187,7 @@ public abstract class AbstractDeployMojo extends AbstractIntegrationTestMojo {
        *      Guide
        */
       @Parameter(property = "ivy.deploy.options.file", required = false)
    -  protected File deployOptionsFile;
    +  protected Path deployOptionsFile;
     
       @Component
       private MavenFileFilter fileFilter;
    @@ -218,7 +220,7 @@ protected final boolean checkSkip() {
           getLog().info("Skipping deployment to engine.");
           return true;
         }
    -    if (!deployFile.exists()) {
    +    if (!Files.exists(deployFile)) {
           getLog().warn("Skipping deployment of '" + deployFile + "' to engine. The file does not exist.");
           return true;
         }
    @@ -234,7 +236,7 @@ protected final File createDeployOptionsFile(DeploymentOptionsFileFactory option
         try {
           String yamlOptions = YamlOptionsFactory.toYaml(this);
           if (StringUtils.isNotBlank(yamlOptions)) {
    -        return optionsFileFactory.createFromConfiguration(yamlOptions);
    +        return optionsFileFactory.createFromConfiguration(yamlOptions).toFile();
           }
         } catch (IOException ex) {
           throw new MojoExecutionException("Failed to generate YAML option", ex);
    @@ -248,17 +250,22 @@ protected static final void removeTemporaryDeploymentOptionsFile(File deployment
     
       protected final void deployToDirectory(File resolvedOptionsFile, File deployDir)
               throws MojoExecutionException {
    -    File targetDeployableFile = createTargetDeployableFile(deployDir);
    -    String deployablePath = deployDir.toPath().relativize(targetDeployableFile.toPath()).toString();
    -    IvyDeployer deployer = new FileDeployer(deployDir, resolvedOptionsFile, deployTimeoutInSeconds,
    -            deployFile, targetDeployableFile);
    +    var targetDeployableFile = createTargetDeployableFile(deployDir);
    +    String deployablePath = deployDir.toPath().relativize(targetDeployableFile).toString();
    +    if (resolvedOptionsFile == null) {
    +
    +    }
    +    IvyDeployer deployer = new FileDeployer(deployDir.toPath(), toPath(resolvedOptionsFile), deployTimeoutInSeconds, deployFile, targetDeployableFile);
         deployer.deploy(deployablePath, getLog());
       }
     
    -  private final File createTargetDeployableFile(File deployDir) {
    -    File deployApp = new File(deployDir, deployToEngineApplication);
    -    File targetDeployableFile = new File(deployApp, deployFile.getName());
    -    return targetDeployableFile;
    +  private Path toPath(File file) {
    +    return file == null ? null : file.toPath();
       }
     
    -}
    \ No newline at end of file
    +  private final Path createTargetDeployableFile(File deployDir) {
    +    return deployDir.toPath()
    +            .resolve(deployToEngineApplication)
    +            .resolve(deployFile.getFileName().toString());
    +  }
    +}
    diff --git a/src/main/java/ch/ivyteam/ivy/maven/deploy/DeployToEngineMojo.java b/src/main/java/ch/ivyteam/ivy/maven/deploy/DeployToEngineMojo.java
    index adb572de..fb5cfc8f 100644
    --- a/src/main/java/ch/ivyteam/ivy/maven/deploy/DeployToEngineMojo.java
    +++ b/src/main/java/ch/ivyteam/ivy/maven/deploy/DeployToEngineMojo.java
    @@ -17,6 +17,7 @@
     package ch.ivyteam.ivy.maven.deploy;
     
     import java.io.File;
    +import java.nio.file.Path;
     import java.nio.file.Paths;
     
     import org.apache.commons.lang3.StringUtils;
    @@ -81,7 +82,7 @@ public class DeployToEngineMojo extends AbstractDeployMojo {
        * \\myRemoteHost\myEngineShare
        */
       @Parameter(property = "ivy.deploy.engine.dir", defaultValue = DEPLOY_ENGINE_DIR_DEFAULT)
    -  File deployEngineDirectory;
    +  Path deployEngineDirectory;
     
       /**
        * The auto deployment directory of the engine. Must match the ivy engine
    @@ -136,7 +137,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
                   "The parameter 'deployToEngineApplication' for goal " + GOAL + " is missing.");
         }
     
    -    File resolvedOptionsFile = createDeployOptionsFile(new DeploymentOptionsFileFactory(deployFile));
    +    var resolvedOptionsFile = createDeployOptionsFile(new DeploymentOptionsFileFactory(deployFile));
         try {
           deployWithOptions(resolvedOptionsFile);
         } finally {
    @@ -145,7 +146,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
       }
     
       private void deployWithOptions(File resolvedOptionsFile) throws MojoExecutionException {
    -    getLog().info("Deploying project " + deployFile.getName());
    +    getLog().info("Deploying project " + deployFile.getFileName());
         if (DeployMethod.DIRECTORY.equals(deployMethod)) {
           deployToDirectory(resolvedOptionsFile);
         } else if (DeployMethod.HTTP.equals(deployMethod)) {
    @@ -184,8 +185,7 @@ private void deployToRestService(File resolvedOptionsFile) throws MojoExecutionE
           getLog().warn("Can not load credentials from settings.xml because server '" + deployServerId
                   + "' is not definied. Try to deploy with default username, password");
         }
    -    HttpDeployer httpDeployer = new HttpDeployer(secDispatcher, server,
    -            deployEngineUrl, deployToEngineApplication, deployFile, resolvedOptionsFile);
    +    var httpDeployer = new HttpDeployer(secDispatcher, server, deployEngineUrl, deployToEngineApplication, deployFile, resolvedOptionsFile.toPath());
         httpDeployer.deploy(getLog());
       }
     
    @@ -195,8 +195,8 @@ private void checkHttpParams() {
         }
         Object defaultDeployEngineDirectory = project.getProperties().get(ENGINE_DIRECTORY_PROPERTY);
         if (deployEngineDirectory != null
    -            && !deployEngineDirectory.getPath().equals(defaultDeployEngineDirectory)) {
    -      logParameterIgnoredByMethod("deployEngineDirectory", deployEngineDirectory.getPath(),
    +            && !deployEngineDirectory.toFile().getPath().equals(defaultDeployEngineDirectory)) {
    +      logParameterIgnoredByMethod("deployEngineDirectory", deployEngineDirectory.toFile().getPath(),
                   DeployMethod.HTTP);
         }
       }
    @@ -216,14 +216,13 @@ private void logParameterIgnoredByMethod(String parameter, String value, String
       }
     
       private File getDeployDirectory() throws MojoExecutionException {
    -    if (deployEngineDirectory == null || engineToTarget()) { // re-use engine
    -                                                             // used to build
    -      deployEngineDirectory = getEngineDir(project);
    +    if (deployEngineDirectory == null || engineToTarget()) { // re-use engine used to build
    +      deployEngineDirectory = getEngineDir(project).toPath();
         }
         if (Paths.get(deployDirectory).isAbsolute()) {
           return new File(deployDirectory);
         }
    -    return new File(deployEngineDirectory, deployDirectory);
    +    return new File(deployEngineDirectory.toFile(), deployDirectory);
       }
     
       public static interface DefaultDeployOptions {
    diff --git a/src/main/java/ch/ivyteam/ivy/maven/deploy/DeployToTestEngineMojo.java b/src/main/java/ch/ivyteam/ivy/maven/deploy/DeployToTestEngineMojo.java
    index cb480e07..aec6ecae 100644
    --- a/src/main/java/ch/ivyteam/ivy/maven/deploy/DeployToTestEngineMojo.java
    +++ b/src/main/java/ch/ivyteam/ivy/maven/deploy/DeployToTestEngineMojo.java
    @@ -85,7 +85,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
         var props = new MavenProperties(project, getLog());
         props.set(Property.TEST_ENGINE_APP, deployToEngineApplication);
     
    -    boolean isDefaultFile = deployFile.getName()
    +    boolean isDefaultFile = deployFile.getFileName()
                 .endsWith(project.getArtifactId() + "-" + project.getVersion() + ".iar");
         if (isDefaultFile && deployDepsAsApp) {
           provideDepsAsAppZip();
    @@ -99,36 +99,36 @@ static String toAppName(String artifact) {
       }
     
       private void provideDepsAsAppZip() {
    -    List deps = MavenRuntime.getDependencies(project, session, "iar");
    +    var deps = MavenRuntime.getDependencies(project, session, "iar");
         if (deps.isEmpty()) {
           return;
         }
     
         deps.add(deployFile);
         try {
    -      File appZip = createFullAppZip(deps);
    -      getLog().info("Using " + appZip.getName()
    -              + " with all IAR dependencies of this test project for deployments.");
    +      var appZip = createFullAppZip(deps);
    +      getLog().info("Using " + appZip.getFileName() + " with all IAR dependencies of this test project for deployments.");
           deployFile = appZip;
         } catch (ArchiverException | IOException ex) {
           getLog().error("Failed to write deployable application ", ex);
         }
       }
     
    -  File createFullAppZip(List deps) throws ArchiverException, IOException {
    +  Path createFullAppZip(List deps) throws ArchiverException, IOException {
         File appZip = new File(project.getBuild().getDirectory(), deployToEngineApplication + "-app.zip");
         ZipArchiver appZipper = new ZipArchiver();
         appZipper.setDestFile(appZip);
    -    for (File dep : deps) {
    -      if (dep.isFile() && dep.getName().endsWith("iar")) {
    -        appZipper.addFile(dep, dep.getName());
    -      } else if (dep.isDirectory()) {
    -        Optional packedIar = findPackedIar(dep);
    +    for (var dep : deps) {
    +      var d = dep.toFile();
    +      if (d.isFile() && d.getName().endsWith("iar")) {
    +        appZipper.addFile(d, d.getName());
    +      } else if (d.isDirectory()) {
    +        Optional packedIar = findPackedIar(d);
             if (packedIar.isPresent()) {
               File iar = packedIar.get().toFile();
               appZipper.addFile(iar, iar.getName());
             } else {
    -          appZipper.addDirectory(dep, dep.getName() + "/");
    +          appZipper.addDirectory(d, d.getName() + "/");
             }
           } else {
             getLog().warn("Can not add dependency to app zip '" + dep + "'. \n "
    @@ -136,7 +136,7 @@ File createFullAppZip(List deps) throws ArchiverException, IOException {
           }
         }
         appZipper.createArchive();
    -    return appZip;
    +    return appZip.toPath();
       }
     
       static Optional findPackedIar(File dep) throws IOException {
    diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/EngineClassLoaderFactory.java b/src/main/java/ch/ivyteam/ivy/maven/engine/EngineClassLoaderFactory.java
    index fe89f08e..c507da49 100644
    --- a/src/main/java/ch/ivyteam/ivy/maven/engine/EngineClassLoaderFactory.java
    +++ b/src/main/java/ch/ivyteam/ivy/maven/engine/EngineClassLoaderFactory.java
    @@ -126,7 +126,7 @@ public void writeEngineClasspathJar(File engineDirectory) throws IOException {
       }
     
       private void writeEngineClasspathJar(List ivyEngineClassPathFiles) throws IOException {
    -    File classPathJar = new SharedFile(maven.project).getEngineClasspathJar();
    +    var classPathJar = new SharedFile(maven.project).getEngineClasspathJar().toFile();
         ClasspathJar jar = new ClasspathJar(classPathJar);
         jar.setMainClass("ch.ivyteam.ivy.server.ServerLauncher");
         jar.createFileEntries(ivyEngineClassPathFiles);
    diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/EngineControl.java b/src/main/java/ch/ivyteam/ivy/maven/engine/EngineControl.java
    index 34440809..bee2af0e 100644
    --- a/src/main/java/ch/ivyteam/ivy/maven/engine/EngineControl.java
    +++ b/src/main/java/ch/ivyteam/ivy/maven/engine/EngineControl.java
    @@ -18,8 +18,6 @@
     
     import java.io.ByteArrayOutputStream;
     import java.io.File;
    -import java.io.FileNotFoundException;
    -import java.io.FileOutputStream;
     import java.io.IOException;
     import java.io.OutputStream;
     import java.net.URI;
    @@ -28,6 +26,7 @@
     import java.net.http.HttpRequest;
     import java.net.http.HttpResponse;
     import java.net.http.HttpResponse.BodyHandlers;
    +import java.nio.file.Files;
     import java.util.concurrent.TimeUnit;
     import java.util.concurrent.TimeoutException;
     import java.util.concurrent.atomic.AtomicBoolean;
    @@ -113,13 +112,13 @@ private CommandLine toEngineCommand(Command command) {
           classpath += File.pathSeparator + context.vmOptions.additionalClasspath;
         }
     
    -    File osgiDir = new File(context.engineDirectory, OsgiDir.INSTALL_AREA);
    +    var osgiDir = context.engineDirectory.resolve(OsgiDir.INSTALL_AREA);
     
         CommandLine cli = new CommandLine(new File(getJavaExec()))
                 .addArgument("-classpath").addArgument(classpath)
                 .addArgument("-Divy.engine.testheadless=true")
                 .addArgument("-Djava.awt.headless=true")
    -            .addArgument("-Dosgi.install.area=" + osgiDir.getAbsolutePath());
    +            .addArgument("-Dosgi.install.area=" + osgiDir.toAbsolutePath());
     
         if (StringUtils.isNotBlank(context.vmOptions.additionalVmOptions)) {
           cli.addArguments(context.vmOptions.additionalVmOptions, false);
    @@ -134,12 +133,12 @@ private CommandLine toEngineCommand(Command command) {
     
       private Executor createEngineExecutor() {
         return DefaultExecutor.builder()
    -            .setWorkingDirectory(context.engineDirectory)
    +            .setWorkingDirectory(context.engineDirectory.toFile())
                 .get();
       }
     
       private PumpStreamHandler createEngineLogStreamForwarder(Consumer logLineHandler)
    -          throws FileNotFoundException {
    +          throws IOException {
         OutputStream output = getEngineLogTarget();
         OutputStream engineLogStream = new LineOrientedOutputStreamRedirector(output) {
           @Override
    @@ -163,15 +162,17 @@ public void stop() throws IOException {
         return streamHandler;
       }
     
    -  private OutputStream getEngineLogTarget() throws FileNotFoundException {
    +  private OutputStream getEngineLogTarget() throws IOException {
         if (context.engineLogFile == null) {
           context.log.info("Do not forward engine output to a persistent location");
           return new ByteArrayOutputStream();
         }
     
    -    context.properties.setMavenProperty(Property.TEST_ENGINE_LOG, context.engineLogFile.getAbsolutePath());
    -    context.log.info("Forwarding engine logs to: " + context.engineLogFile.getAbsolutePath());
    -    return new FileOutputStream(context.engineLogFile.getAbsolutePath());
    +    var logFile = context.engineLogFile;
    +    var logFilePath = logFile.toAbsolutePath().toString();
    +    context.properties.setMavenProperty(Property.TEST_ENGINE_LOG, logFilePath);
    +    context.log.info("Forwarding engine logs to: " + logFilePath);
    +    return Files.newOutputStream(logFile);
       }
     
       private String getJavaExec() {
    diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/EngineModuleHints.java b/src/main/java/ch/ivyteam/ivy/maven/engine/EngineModuleHints.java
    index 26c9671d..d0b06b06 100644
    --- a/src/main/java/ch/ivyteam/ivy/maven/engine/EngineModuleHints.java
    +++ b/src/main/java/ch/ivyteam/ivy/maven/engine/EngineModuleHints.java
    @@ -1,8 +1,8 @@
     package ch.ivyteam.ivy.maven.engine;
     
    -import java.io.File;
     import java.io.IOException;
     import java.nio.file.Files;
    +import java.nio.file.Path;
     import java.util.List;
     import java.util.stream.Collectors;
     
    @@ -15,12 +15,12 @@ public static void loadFromJvmOptionsFile(EngineMojoContext context, CommandLine
         loadJvmOptions(context.engineDirectory, context.log).stream().forEach(option -> cli.addArgument(option));
       }
     
    -  public static String loadFromJvmOptionsFile(File identifyAndGetEngineDirectory, Log log) {
    +  public static String loadFromJvmOptionsFile(Path identifyAndGetEngineDirectory, Log log) {
         return loadJvmOptions(identifyAndGetEngineDirectory, log).stream().collect(Collectors.joining(" ", " ", " "));
       }
     
    -  private static List loadJvmOptions(File engineDir, Log log) {
    -    var jvmOptionsFile = engineDir.toPath().resolve("bin").resolve("jvm-module.options");
    +  private static List loadJvmOptions(Path engineDir, Log log) {
    +    var jvmOptionsFile = engineDir.resolve("bin").resolve("jvm-module.options");
         if (!Files.exists(jvmOptionsFile)) {
           log.warn("Couldn't load jvm module options from '" + jvmOptionsFile + "' file.");
           return List.of();
    diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/EngineMojoContext.java b/src/main/java/ch/ivyteam/ivy/maven/engine/EngineMojoContext.java
    index 7757cbcc..a003fe5e 100644
    --- a/src/main/java/ch/ivyteam/ivy/maven/engine/EngineMojoContext.java
    +++ b/src/main/java/ch/ivyteam/ivy/maven/engine/EngineMojoContext.java
    @@ -17,6 +17,8 @@
     package ch.ivyteam.ivy.maven.engine;
     
     import java.io.File;
    +import java.nio.file.Files;
    +import java.nio.file.Path;
     
     import org.apache.maven.plugin.logging.Log;
     import org.apache.maven.project.MavenProject;
    @@ -26,16 +28,16 @@
     import ch.ivyteam.ivy.maven.util.SharedFile;
     
     public class EngineMojoContext {
    -  public final File engineDirectory;
    +  public final Path engineDirectory;
       public final MavenProject project;
       public final Log log;
       public final EngineVmOptions vmOptions;
       public final String engineClasspathJarPath;
       public final MavenProperties properties;
    -  public final File engineLogFile;
    +  public final Path engineLogFile;
       public final Integer timeoutInSeconds;
     
    -  public EngineMojoContext(File engineDirectory, MavenProject project, Log log, File engineLogFile,
    +  public EngineMojoContext(Path engineDirectory, MavenProject project, Log log, Path engineLogFile,
               EngineVmOptions vmOptions, Integer timeoutInSeconds) {
         this.engineDirectory = engineDirectory;
         this.project = project;
    @@ -50,25 +52,23 @@ public EngineMojoContext(File engineDirectory, MavenProject project, Log log, Fi
         if (!(new File(engineClasspathJarPath).exists())) {
           throw new RuntimeException("Engine ClasspathJar " + engineClasspathJarPath + " does not exist.");
         }
    -    if (!(engineDirectory.exists())) {
    +    if (!Files.exists(engineDirectory)) {
           throw new RuntimeException("Engine Directory " + engineDirectory + " does not exist.");
         }
       }
     
       private String setupEngineClasspathJarIfNotExists() {
    -    File classpathJar = new SharedFile(project).getEngineOSGiBootClasspathJar();
    -
    +    var classpathJar = new SharedFile(project).getEngineOSGiBootClasspathJar().toFile();
         if (!classpathJar.exists()) {
           try {
             log.info("Creating a classpath jar for starting the engine");
             new ClasspathJar(classpathJar)
    -                .createFileEntries(EngineClassLoaderFactory.getOsgiBootstrapClasspath(engineDirectory));
    +                .createFileEntries(EngineClassLoaderFactory.getOsgiBootstrapClasspath(engineDirectory.toFile()));
           } catch (Exception ex) {
             throw new RuntimeException(
                     "Could not create engine classpath jar: '" + classpathJar.getAbsolutePath() + "'", ex);
           }
         }
    -
         return classpathJar.getAbsolutePath();
       }
     }
    diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/EngineVersionEvaluator.java b/src/main/java/ch/ivyteam/ivy/maven/engine/EngineVersionEvaluator.java
    index f77f9452..b3df05c1 100644
    --- a/src/main/java/ch/ivyteam/ivy/maven/engine/EngineVersionEvaluator.java
    +++ b/src/main/java/ch/ivyteam/ivy/maven/engine/EngineVersionEvaluator.java
    @@ -1,6 +1,7 @@
     package ch.ivyteam.ivy.maven.engine;
     
    -import java.io.File;
    +import java.nio.file.Files;
    +import java.nio.file.Path;
     
     import org.apache.commons.lang3.ArrayUtils;
     import org.apache.commons.lang3.StringUtils;
    @@ -11,19 +12,20 @@
     import ch.ivyteam.ivy.maven.engine.EngineClassLoaderFactory.OsgiDir;
     
     public class EngineVersionEvaluator {
    +
       public static final String LIBRARY_ID = "ch.ivyteam.util";
     
       private Log log;
    -  private File engineDir;
    +  private Path engineDir;
     
    -  public EngineVersionEvaluator(Log log, File engineDir) {
    +  public EngineVersionEvaluator(Log log, Path engineDir) {
         this.log = log;
         this.engineDir = engineDir;
       }
     
       public ArtifactVersion evaluateVersion() {
         if (!isOSGiEngine(engineDir)) {
    -      String absolutePath = engineDir == null ? "" : engineDir.getAbsolutePath();
    +      String absolutePath = engineDir == null ? "" : engineDir.toAbsolutePath().toString();
           log.info("Can not evaluate version of a non-OSGi engine in directory '" + absolutePath + "'");
           return null;
         }
    @@ -37,9 +39,9 @@ public ArtifactVersion evaluateVersion() {
         return new DefaultArtifactVersion(toReleaseVersion(version));
       }
     
    -  public static boolean isOSGiEngine(File engineDir) {
    -    File folder = new File(engineDir, OsgiDir.INSTALL_AREA);
    -    return folder.exists();
    +  public static boolean isOSGiEngine(Path engineDir) {
    +    var folder = engineDir.resolve(OsgiDir.INSTALL_AREA);
    +    return Files.exists(folder);
       }
     
       public static String toReleaseVersion(String version) { // 6.1.0.51869 ->
    @@ -52,12 +54,12 @@ public static String toReleaseVersion(String version) { // 6.1.0.51869 ->
       }
     
       private String getLibraryFileName(String libraryId) {
    -    File ivyLibs = new File(engineDir, OsgiDir.PLUGINS);
    -    if (!ivyLibs.exists()) {
    +    var ivyLibs = engineDir.resolve(OsgiDir.PLUGINS);
    +    if (!Files.exists(ivyLibs)) {
           return null;
         }
     
    -    String[] libraryNames = ivyLibs.list();
    +    String[] libraryNames = ivyLibs.toFile().list();
         if (libraryNames == null) {
           return null;
         }
    @@ -69,5 +71,4 @@ private String getLibraryFileName(String libraryId) {
         }
         return null;
       }
    -
     }
    diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/MavenProjectBuilderProxy.java b/src/main/java/ch/ivyteam/ivy/maven/engine/MavenProjectBuilderProxy.java
    index a5f8d1b3..ec50e356 100644
    --- a/src/main/java/ch/ivyteam/ivy/maven/engine/MavenProjectBuilderProxy.java
    +++ b/src/main/java/ch/ivyteam/ivy/maven/engine/MavenProjectBuilderProxy.java
    @@ -37,7 +37,7 @@
     /**
      * Provides project build functionality that can only be accessed trough
      * reflection on an ivy Engine classloader.
    - * 
    + *
      * @author Reguel Wermelinger
      * @since 6.0.0
      */
    @@ -81,7 +81,7 @@ private void logEngine()
     
       private Class getOsgiBundledDelegate(URLClassLoader ivyEngineClassLoader,
               int timeoutEngineStartInSeconds) throws Exception {
    -    Object bundleContext = new OsgiRuntime(baseDirToBuildIn, log).startEclipseOsgiImpl(ivyEngineClassLoader,
    +    Object bundleContext = new OsgiRuntime(baseDirToBuildIn.toPath(), log).startEclipseOsgiImpl(ivyEngineClassLoader,
                 timeoutEngineStartInSeconds);
         hackProvokeEagerStartOfJdt(bundleContext);
         Object buildBundle = findBundle(bundleContext, "ch.ivyteam.ivy.dataclasses.build");
    diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/OsgiRuntime.java b/src/main/java/ch/ivyteam/ivy/maven/engine/OsgiRuntime.java
    index b0b16983..47e465ae 100644
    --- a/src/main/java/ch/ivyteam/ivy/maven/engine/OsgiRuntime.java
    +++ b/src/main/java/ch/ivyteam/ivy/maven/engine/OsgiRuntime.java
    @@ -1,8 +1,8 @@
     package ch.ivyteam.ivy.maven.engine;
     
    -import java.io.File;
     import java.lang.reflect.Method;
     import java.net.URLClassLoader;
    +import java.nio.file.Path;
     import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.LinkedHashMap;
    @@ -25,10 +25,11 @@
      * @since 7.0
      */
     class OsgiRuntime {
    -  private final File engineDir;
    +
    +  private final Path engineDir;
       private final Log log;
     
    -  OsgiRuntime(File engineDir, Log log) {
    +  OsgiRuntime(Path engineDir, Log log) {
         this.engineDir = engineDir;
         this.log = log;
       }
    @@ -96,9 +97,9 @@ private Map createOsgiConfigurationProps() {
         Map properties = new LinkedHashMap<>();
     
         properties.put("osgi.framework.useSystemProperties", Boolean.TRUE.toString());
    -    properties.put("user.dir", engineDir.getAbsolutePath());
    -    File osgiDir = new File(engineDir, OsgiDir.INSTALL_AREA);
    -    properties.put("osgi.install.area", osgiDir.getAbsolutePath());
    +    properties.put("user.dir", engineDir.toAbsolutePath().toString());
    +    var osgiDir = engineDir.resolve(OsgiDir.INSTALL_AREA);
    +    properties.put("osgi.install.area", osgiDir.toAbsolutePath().toString());
         properties.put("org.osgi.framework.bundle.parent", "framework");
         properties.put("org.osgi.framework.bootdelegation",
                 "javax.annotation,ch.ivyteam.ivy.boot.osgi.win,ch.ivyteam.ivy.jaas," // original
    diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/DeploymentOptionsFileFactory.java b/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/DeploymentOptionsFileFactory.java
    index 009633ed..102632ba 100644
    --- a/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/DeploymentOptionsFileFactory.java
    +++ b/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/DeploymentOptionsFileFactory.java
    @@ -3,9 +3,9 @@
     import java.io.File;
     import java.io.IOException;
     import java.nio.charset.StandardCharsets;
    +import java.nio.file.Path;
     import java.util.Collections;
     
    -import org.apache.commons.io.FileUtils;
     import org.apache.commons.io.FilenameUtils;
     import org.apache.maven.execution.MavenSession;
     import org.apache.maven.plugin.MojoExecutionException;
    @@ -14,28 +14,29 @@
     import org.apache.maven.shared.filtering.MavenFilteringException;
     
     public class DeploymentOptionsFileFactory {
    +
       private static final String YAML = "yaml";
    -  private final File deployableArtifact;
    +  private final Path deployableArtifact;
     
    -  public DeploymentOptionsFileFactory(File deployableArtifact) {
    +  public DeploymentOptionsFileFactory(Path deployableArtifact) {
         this.deployableArtifact = deployableArtifact;
       }
     
    -  public File createFromTemplate(File optionsFile, MavenProject project, MavenSession session,
    +  public File createFromTemplate(Path optionsFile, MavenProject project, MavenSession session,
               MavenFileFilter fileFilter) throws MojoExecutionException {
    -    if (!isOptionsFile(optionsFile)) {
    +    if (!isOptionsFile(optionsFile.toFile())) {
           return null;
         }
     
    -    String fileFormat = FilenameUtils.getExtension(optionsFile.getName());
    -    File targetFile = getTargetFile(fileFormat);
    +    String fileFormat = FilenameUtils.getExtension(optionsFile.getFileName().toString());
    +    var targetFile = getTargetFile(fileFormat);
         try {
    -      fileFilter.copyFile(optionsFile, targetFile, true, project, Collections.emptyList(), false,
    +      fileFilter.copyFile(optionsFile.toFile(), targetFile.toFile(), true, project, Collections.emptyList(), false,
                   StandardCharsets.UTF_8.name(), session);
         } catch (MavenFilteringException ex) {
           throw new MojoExecutionException("Failed to resolve templates in options file", ex);
         }
    -    return targetFile;
    +    return targetFile.toFile();
       }
     
       private static boolean isOptionsFile(File optionsFile) {
    @@ -45,20 +46,19 @@ private static boolean isOptionsFile(File optionsFile) {
                 optionsFile.canRead();
       }
     
    -  public File createFromConfiguration(String options) throws MojoExecutionException {
    -    File yamlOptionsFile = getTargetFile(YAML);
    +  public Path createFromConfiguration(String options) throws MojoExecutionException {
    +    var yamlOptionsFile = getTargetFile(YAML);
         try {
    -      FileUtils.write(yamlOptionsFile, options, StandardCharsets.UTF_8);
    +      java.nio.file.Files.writeString(yamlOptionsFile, options);
         } catch (IOException ex) {
           throw new MojoExecutionException("Failed to write options file '" + yamlOptionsFile + "'.", ex);
         }
         return yamlOptionsFile;
       }
     
    -  private File getTargetFile(String fileFormat) {
    -    String prefix = deployableArtifact.getName() + ".options.";
    -    String targetFileName = prefix + fileFormat;
    -    return new File(deployableArtifact.getParentFile(), targetFileName);
    +  private Path getTargetFile(String fileFormat) {
    +    var prefix = deployableArtifact.getFileName().toString() + ".options.";
    +    var targetFileName = prefix + fileFormat;
    +    return deployableArtifact.resolveSibling(targetFileName);
       }
    -
     }
    diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/DeploymentFiles.java b/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/DeploymentFiles.java
    index 4da43318..a873dc28 100644
    --- a/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/DeploymentFiles.java
    +++ b/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/DeploymentFiles.java
    @@ -1,42 +1,50 @@
     package ch.ivyteam.ivy.maven.engine.deploy.dir;
     
    -import java.io.File;
    -import java.util.Arrays;
    -
    -import org.apache.commons.io.FileUtils;
    +import java.io.IOException;
    +import java.nio.file.Files;
    +import java.nio.file.Path;
    +import java.util.List;
     
     /**
      * Engine status files from deployment.
      */
     public class DeploymentFiles {
    +
       private static final String LOG = ".deploymentLog";
       private static final String ERROR_LOG = ".deploymentError";
     
    -  private File deployable;
    +  private final Path deployable;
     
    -  public DeploymentFiles(File deployable) {
    +  public DeploymentFiles(Path deployable) {
         this.deployable = deployable;
       }
     
    -  File getDeployCandidate() {
    +  Path getDeployCandidate() {
         return deployable;
       }
     
    -  public File log() {
    -    return getFile(LOG);
    +  public Path log() {
    +    return toFile(LOG);
       }
     
    -  public File errorLog() {
    -    return getFile(ERROR_LOG);
    +  public Path errorLog() {
    +    return toFile(ERROR_LOG);
       }
     
    -  private File getFile(String markerExtension) {
    -    return new File(deployable.getParent(), deployable.getName() + markerExtension);
    +  private Path toFile(String ext) {
    +    return deployable.resolveSibling(deployable.getFileName() + ext);
       }
     
       public void clearAll() {
    -    for (String markerExtension : Arrays.asList(LOG, ERROR_LOG)) {
    -      FileUtils.deleteQuietly(getFile(markerExtension));
    +    for (var ext : List.of(LOG, ERROR_LOG)) {
    +      var file = toFile(ext);
    +      if (Files.exists(file)) {
    +        try {
    +          Files.delete(file);
    +        } catch (IOException ex) {
    +          throw new RuntimeException("Could not delete " + file, ex);
    +        }
    +      }
         }
       }
    -}
    \ No newline at end of file
    +}
    diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/FileDeployer.java b/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/FileDeployer.java
    index 279e8720..f74e730e 100644
    --- a/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/FileDeployer.java
    +++ b/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/FileDeployer.java
    @@ -17,7 +17,8 @@
     
     import java.io.File;
     import java.io.IOException;
    -import java.nio.charset.StandardCharsets;
    +import java.nio.file.Files;
    +import java.nio.file.Path;
     import java.util.concurrent.TimeUnit;
     import java.util.concurrent.TimeoutException;
     import java.util.function.Supplier;
    @@ -27,20 +28,20 @@
     import org.apache.maven.plugin.logging.Log;
     
     public class FileDeployer implements IvyDeployer {
    -  private final File deployDir;
    +
    +  private final Path deployDir;
    +  private final Path deploymentOptionsFile;
       private final Integer timeoutInSeconds;
    +  private final Path deployFile;
    +  private final Path targetDeployableFile;
     
       private Log log;
       private DeploymentFiles deploymentFiles;
     
    -  private File deployFile;
    -  private File targetDeployableFile;
    -  private File deploymentOptionsFile;
     
    -  public FileDeployer(File deployDir, File deploymentOptions, Integer deployTimeoutInSeconds, File deployFile,
    -          File targetDeployableFile) {
    +  public FileDeployer(Path deployDir, Path deploymentOptionsFile, Integer deployTimeoutInSeconds, Path deployFile, Path targetDeployableFile) {
         this.deployDir = deployDir;
    -    this.deploymentOptionsFile = deploymentOptions;
    +    this.deploymentOptionsFile = deploymentOptionsFile;
         this.timeoutInSeconds = deployTimeoutInSeconds;
     
         this.deployFile = deployFile;
    @@ -50,10 +51,9 @@ public FileDeployer(File deployDir, File deploymentOptions, Integer deployTimeou
       @Override
       @SuppressWarnings("hiding")
       public void deploy(String deployableFilePath, Log log) throws MojoExecutionException {
    -    File deployableFile = new File(deployDir, deployableFilePath);
    +    var deployableFile = deployDir.resolve(deployableFilePath);
         this.deploymentFiles = new DeploymentFiles(deployableFile);
         this.log = log;
    -
         deployInternal();
       }
     
    @@ -71,9 +71,10 @@ private void clear() {
       private void initDeployment() throws MojoExecutionException {
         try {
           if (deploymentOptionsFile != null) {
    -        File engineOption = new File(deploymentFiles.getDeployCandidate().getParentFile(),
    -                deploymentOptionsFile.getName());
    -        FileUtils.copyFile(deploymentOptionsFile, engineOption);
    +        //var engineOption = deploymentFiles.getDeployCandidate().resolveSibling(deploymentOptionsFile.getName());
    +        //Files.copy(deploymentOptionsFile.toPath(), engineOption);
    +        File engineOption = new File(deploymentFiles.getDeployCandidate().getParent().toFile(), deploymentOptionsFile.getFileName().toString());
    +        FileUtils.copyFile(deploymentOptionsFile.toFile(), engineOption);
           }
         } catch (IOException ex) {
           throw new MojoExecutionException("Failed to initialize engine deployment, could not copy options file",
    @@ -84,19 +85,18 @@ private void initDeployment() throws MojoExecutionException {
       private void copyDeployableToEngine() throws MojoExecutionException {
         try {
           log.info("Uploading file " + deployFile + " to " + targetDeployableFile);
    -      FileUtils.copyFile(deployFile, targetDeployableFile);
    +      FileUtils.copyFile(deployFile.toFile(), targetDeployableFile.toFile());
         } catch (IOException ex) {
    -      throw new MojoExecutionException("Upload of file '" + deployFile.getName() + "' to engine failed.", ex);
    +      throw new MojoExecutionException("Upload of file '" + deployFile.getFileName().toString() + "' to engine failed.", ex);
         }
       }
     
       private void determineDeployResult() throws MojoExecutionException {
    -    FileLogForwarder logForwarder = new FileLogForwarder(deploymentFiles.log(), log,
    -            new EngineLogLineHandler(log));
    +    var logForwarder = new FileLogForwarder(deploymentFiles.log(), log, new EngineLogLineHandler(log));
         try {
           logForwarder.activate();
           log.debug("Deployment candidate " + deploymentFiles.getDeployCandidate());
    -      wait(() -> !deploymentFiles.getDeployCandidate().exists(), timeoutInSeconds, TimeUnit.SECONDS);
    +      wait(() -> !Files.exists(deploymentFiles.getDeployCandidate()), timeoutInSeconds, TimeUnit.SECONDS);
         } catch (TimeoutException ex) {
           throw new MojoExecutionException("Deployment result does not exist", ex);
         } finally {
    @@ -108,14 +108,15 @@ private void determineDeployResult() throws MojoExecutionException {
       }
     
       private void failOnError() throws MojoExecutionException {
    -    if (deploymentFiles.errorLog().exists()) {
    +    var errorLog = deploymentFiles.errorLog();
    +    if (Files.exists(errorLog)) {
           try {
    -        log.error(FileUtils.readFileToString(deploymentFiles.errorLog(), StandardCharsets.UTF_8));
    +        var content = Files.readString(errorLog);
    +        log.error(content);
           } catch (IOException ex) {
             log.error("Failed to resolve deployment error cause", ex);
           }
    -      throw new MojoExecutionException(
    -              "Deployment of '" + deploymentFiles.getDeployCandidate().getName() + "' failed!");
    +      throw new MojoExecutionException("Deployment of '" + deploymentFiles.getDeployCandidate().getFileName() + "' failed!");
         }
       }
     
    diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/FileLogForwarder.java b/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/FileLogForwarder.java
    index c4596d82..d307df29 100644
    --- a/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/FileLogForwarder.java
    +++ b/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/FileLogForwarder.java
    @@ -19,6 +19,7 @@
     import java.io.File;
     import java.io.IOException;
     import java.io.RandomAccessFile;
    +import java.nio.file.Path;
     
     import org.apache.commons.io.filefilter.FileFilterUtils;
     import org.apache.commons.io.filefilter.IOFileFilter;
    @@ -33,7 +34,7 @@
      * @since 6.1.0
      */
     class FileLogForwarder {
    -  private final File engineLog;
    +  private final Path engineLog;
       private final Log mavenLog;
     
       private FileAlterationMonitor monitor;
    @@ -43,7 +44,7 @@ class FileLogForwarder {
        * @param engineLog the log file to watch for new lines
        * @param mavenLog the target logger
        */
    -  FileLogForwarder(File engineLog, Log mavenLog, LogLineHandler handler) {
    +  FileLogForwarder(Path engineLog, Log mavenLog, LogLineHandler handler) {
         this.engineLog = engineLog;
         this.mavenLog = mavenLog;
         this.logLineHandler = handler;
    @@ -52,8 +53,8 @@ class FileLogForwarder {
       public synchronized void activate() throws MojoExecutionException {
         IOFileFilter logFilter = FileFilterUtils.and(
                 FileFilterUtils.fileFileFilter(),
    -            FileFilterUtils.nameFileFilter(engineLog.getName()));
    -    FileAlterationObserver fileObserver = new FileAlterationObserver(engineLog.getParent(), logFilter);
    +            FileFilterUtils.nameFileFilter(engineLog.getFileName().toString()));
    +    FileAlterationObserver fileObserver = new FileAlterationObserver(engineLog.getParent().toFile(), logFilter);
         fileObserver.addListener(new LogModificationListener());
         monitor = new FileAlterationMonitor(100);
         monitor.addObserver(fileObserver);
    diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/http/HttpDeployer.java b/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/http/HttpDeployer.java
    index e1da85d9..44fcd5d8 100644
    --- a/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/http/HttpDeployer.java
    +++ b/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/http/HttpDeployer.java
    @@ -1,9 +1,9 @@
     package ch.ivyteam.ivy.maven.engine.deploy.http;
     
    -import java.io.File;
     import java.io.IOException;
     import java.net.URI;
     import java.net.URISyntaxException;
    +import java.nio.file.Path;
     
     import org.apache.http.HttpEntity;
     import org.apache.http.HttpHost;
    @@ -35,13 +35,13 @@ public class HttpDeployer {
       private static final String DEPLOY_URI = "/system/api/apps/";
       private String serverUrl;
       private String targetApplication;
    -  private File deployFile;
    -  private File deploymentOptions;
    +  private Path deployFile;
    +  private Path deploymentOptions;
       private Server server;
       private SecDispatcher secDispatcher;
     
       public HttpDeployer(SecDispatcher secDispatcher, Server server, String serverUrl, String targetApplication,
    -          File deployFile, File deploymentOptions) {
    +          Path deployFile, Path deploymentOptions) {
         this.secDispatcher = secDispatcher;
         this.server = server;
         this.serverUrl = serverUrl;
    @@ -75,8 +75,7 @@ private void executeRequest(Log log, CloseableHttpClient client)
           int status = response.getStatusLine().getStatusCode();
           if (status != HttpStatus.SC_OK) {
             log.error(deploymentLog);
    -        throw new MojoExecutionException("Deployment of file '" + deployFile.getName()
    -                + "' to engine failed (Status: " + status + ")");
    +        throw new MojoExecutionException("Deployment of file '" + deployFile.getFileName() + "' to engine failed (Status: " + status + ")");
           }
           log.debug(deploymentLog);
           log.info("Deployment finished");
    @@ -92,11 +91,11 @@ private String readDeploymentLog(HttpEntity resultEntity) throws IOException {
         return EntityUtils.toString(resultEntity);
       }
     
    -  private HttpEntity getRequestData(File resolvedOptionsFile) {
    +  private HttpEntity getRequestData(Path resolvedOptionsFile) {
         MultipartEntityBuilder builder = MultipartEntityBuilder.create();
    -    builder.addPart("fileToDeploy", new FileBody(deployFile));
    +    builder.addPart("fileToDeploy", new FileBody(deployFile.toFile()));
         if (resolvedOptionsFile != null) {
    -      builder.addPart("deploymentOptions", new FileBody(resolvedOptionsFile, ContentType.TEXT_PLAIN));
    +      builder.addPart("deploymentOptions", new FileBody(resolvedOptionsFile.toFile(), ContentType.TEXT_PLAIN));
         }
         return builder.build();
       }
    diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/download/EngineDownloader.java b/src/main/java/ch/ivyteam/ivy/maven/engine/download/EngineDownloader.java
    index b5659803..96e0274b 100644
    --- a/src/main/java/ch/ivyteam/ivy/maven/engine/download/EngineDownloader.java
    +++ b/src/main/java/ch/ivyteam/ivy/maven/engine/download/EngineDownloader.java
    @@ -1,11 +1,11 @@
     package ch.ivyteam.ivy.maven.engine.download;
     
    -import java.io.File;
    +import java.nio.file.Path;
     
     import org.apache.maven.plugin.MojoExecutionException;
     
     public interface EngineDownloader {
    -  File downloadEngine() throws MojoExecutionException;
     
    +  Path downloadEngine() throws MojoExecutionException;
       String getZipFileNameFromDownloadLocation() throws MojoExecutionException;
     }
    diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/download/MavenEngineDownloader.java b/src/main/java/ch/ivyteam/ivy/maven/engine/download/MavenEngineDownloader.java
    index 5aa877fe..77950e99 100644
    --- a/src/main/java/ch/ivyteam/ivy/maven/engine/download/MavenEngineDownloader.java
    +++ b/src/main/java/ch/ivyteam/ivy/maven/engine/download/MavenEngineDownloader.java
    @@ -1,6 +1,6 @@
     package ch.ivyteam.ivy.maven.engine.download;
     
    -import java.io.File;
    +import java.nio.file.Path;
     import java.util.List;
     
     import org.apache.maven.plugin.MojoExecutionException;
    @@ -46,9 +46,9 @@ private ArtifactResult resolveArtifact() throws MojoExecutionException {
       }
     
       @Override
    -  public File downloadEngine() throws MojoExecutionException {
    +  public Path downloadEngine() throws MojoExecutionException {
         log.info("Downloading engine " + engineArtifact.getVersion() + " using maven plugin repositories");
    -    return resolveArtifact().getArtifact().getFile();
    +    return resolveArtifact().getArtifact().getFile().toPath();
       }
     
       @Override
    diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/download/URLEngineDownloader.java b/src/main/java/ch/ivyteam/ivy/maven/engine/download/URLEngineDownloader.java
    index b729ae10..b296d0fc 100644
    --- a/src/main/java/ch/ivyteam/ivy/maven/engine/download/URLEngineDownloader.java
    +++ b/src/main/java/ch/ivyteam/ivy/maven/engine/download/URLEngineDownloader.java
    @@ -1,6 +1,5 @@
     package ch.ivyteam.ivy.maven.engine.download;
     
    -import java.io.File;
     import java.io.InputStream;
     import java.net.MalformedURLException;
     import java.net.URI;
    @@ -31,12 +30,12 @@ public class URLEngineDownloader implements EngineDownloader {
       private final String ivyVersion;
       private final VersionRange ivyVersionRange;
       private final Log log;
    -  private final File downloadDirectory;
    +  private final Path downloadDirectory;
       private String zipFileName = null;
       public ProxyInfoProvider proxies;
     
       public URLEngineDownloader(URL engineDownloadUrl, URL engineListPageUrl, String osArchitecture,
    -          String ivyVersion, VersionRange ivyVersionRange, Log log, File downloadDirectory,
    +          String ivyVersion, VersionRange ivyVersionRange, Log log, Path downloadDirectory,
               ProxyInfoProvider proxies) {
         this.engineDownloadUrl = engineDownloadUrl;
         this.engineListPageUrl = engineListPageUrl;
    @@ -49,7 +48,7 @@ public URLEngineDownloader(URL engineDownloadUrl, URL engineListPageUrl, String
       }
     
       @Override
    -  public File downloadEngine() throws MojoExecutionException {
    +  public Path downloadEngine() throws MojoExecutionException {
         URL downloadUrlToUse = engineDownloadUrl;
         if (downloadUrlToUse == null) {
           downloadUrlToUse = findEngineDownloadUrlFromListPage();
    @@ -72,13 +71,13 @@ private URL findEngineDownloadUrlFromListPage() throws MojoExecutionException {
         }
       }
     
    -  private File downloadEngineFromUrl(URL engineUrl) throws MojoExecutionException {
    -    File downloadZip = evaluateTargetFile(engineUrl);
    +  private Path downloadEngineFromUrl(URL engineUrl) throws MojoExecutionException {
    +    var downloadZip = evaluateTargetFile(engineUrl);
         try {
           log.info("Starting engine download from " + engineUrl);
           var repo = new Repository("engine.repo", StringUtils.substringBeforeLast(engineUrl.toExternalForm(), "/"));
           var resource = StringUtils.substringAfterLast(engineUrl.getPath(), "/");
    -      wagonDownload(repo, resource, downloadZip.toPath());
    +      wagonDownload(repo, resource, downloadZip);
           return downloadZip;
         } catch (Exception ex) {
           throw new MojoExecutionException("Failed to download engine from '" + engineUrl + "' to '"
    @@ -86,13 +85,13 @@ private File downloadEngineFromUrl(URL engineUrl) throws MojoExecutionException
         }
       }
     
    -  private File evaluateTargetFile(URL engineUrl) {
    +  private Path evaluateTargetFile(URL engineUrl) {
         zipFileName = StringUtils.substringAfterLast(engineUrl.getPath(), "/");
    -    File downloadZip = new File(downloadDirectory, zipFileName);
    +    var downloadZip = downloadDirectory.resolve(zipFileName);
         int tempFileSuffix = 0;
    -    while (downloadZip.exists()) {
    +    while (Files.exists(downloadZip)) {
           String suffixedZipFileName = zipFileName + "." + tempFileSuffix;
    -      downloadZip = new File(downloadDirectory, suffixedZipFileName);
    +      downloadZip = downloadDirectory.resolve(suffixedZipFileName);
           tempFileSuffix++;
         }
         return downloadZip;
    diff --git a/src/main/java/ch/ivyteam/ivy/maven/test/AbstractIntegrationTestMojo.java b/src/main/java/ch/ivyteam/ivy/maven/test/AbstractIntegrationTestMojo.java
    index 4a3e2e36..511b09cc 100644
    --- a/src/main/java/ch/ivyteam/ivy/maven/test/AbstractIntegrationTestMojo.java
    +++ b/src/main/java/ch/ivyteam/ivy/maven/test/AbstractIntegrationTestMojo.java
    @@ -1,6 +1,7 @@
     package ch.ivyteam.ivy.maven.test;
     
     import java.io.File;
    +import java.nio.file.Path;
     import java.util.Objects;
     
     import org.apache.commons.lang3.StringUtils;
    @@ -37,7 +38,7 @@ public abstract class AbstractIntegrationTestMojo extends AbstractEngineMojo {
     
       public final File getEngineDir(MavenProject project) throws MojoExecutionException {
         if (engineToTarget()) {
    -      return getTargetDir(project);
    +      return getTargetDir(project).toFile();
         }
         return findMatchingEngineInCacheDirectory();
       }
    @@ -59,8 +60,8 @@ private boolean isCachedEngine() throws MojoExecutionException {
         return Objects.equals(engineDir.getParentFile(), engineCacheDirectory);
       }
     
    -  File getTargetDir(MavenProject project) {
    -    return new File(project.getBuild().getDirectory(), "ivyEngine");
    +  Path getTargetDir(MavenProject project) {
    +    return Path.of(project.getBuild().getDirectory()).resolve("ivyEngine");
       }
     
       static interface TestEngineLocation {
    diff --git a/src/main/java/ch/ivyteam/ivy/maven/test/SetupIntegrationTestPropertiesMojo.java b/src/main/java/ch/ivyteam/ivy/maven/test/SetupIntegrationTestPropertiesMojo.java
    index 66ca2c06..0f551e63 100644
    --- a/src/main/java/ch/ivyteam/ivy/maven/test/SetupIntegrationTestPropertiesMojo.java
    +++ b/src/main/java/ch/ivyteam/ivy/maven/test/SetupIntegrationTestPropertiesMojo.java
    @@ -58,7 +58,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
                 EngineControl.Property.TEST_ENGINE_URL,
                 EngineControl.Property.TEST_ENGINE_LOG,
                 DeployToTestEngineMojo.Property.TEST_ENGINE_APP);
    -    jmvArgs += EngineModuleHints.loadFromJvmOptionsFile(identifyAndGetEngineDirectory(), getLog());
    +    jmvArgs += EngineModuleHints.loadFromJvmOptionsFile(identifyAndGetEngineDirectory().toPath(), getLog());
         props.append(FAILSAFE_ARGLINE_PROPERTY, jmvArgs);
       }
     
    diff --git a/src/main/java/ch/ivyteam/ivy/maven/test/SetupIvyTestPropertiesMojo.java b/src/main/java/ch/ivyteam/ivy/maven/test/SetupIvyTestPropertiesMojo.java
    index cd24b5e4..361cb596 100644
    --- a/src/main/java/ch/ivyteam/ivy/maven/test/SetupIvyTestPropertiesMojo.java
    +++ b/src/main/java/ch/ivyteam/ivy/maven/test/SetupIvyTestPropertiesMojo.java
    @@ -19,6 +19,7 @@
     import java.io.File;
     import java.io.IOException;
     import java.net.URI;
    +import java.nio.file.Path;
     import java.util.ArrayList;
     import java.util.List;
     import java.util.stream.Collectors;
    @@ -88,23 +89,23 @@ public void execute() throws MojoExecutionException, MojoFailureException {
     
       private void setIvyProperties(MavenProperties properties) throws MojoExecutionException {
         SharedFile shared = new SharedFile(project);
    -    File engineCp = shared.getEngineClasspathJar();
    +    var engineCp = shared.getEngineClasspathJar().toFile();
         if (engineCp.exists()) {
           properties.setMavenProperty(Property.IVY_ENGINE_CLASSPATH, getClasspath(engineCp));
         }
     
    -    File iarCp = shared.getIarDependencyClasspathJar();
    +    var iarCp = shared.getIarDependencyClasspathJar().toFile();
         if (iarCp.exists()) {
           properties.setMavenProperty(Property.IVY_PROJECT_IAR_CLASSPATH, getClasspath(iarCp));
         }
     
    -    File tstVmDir = createTestVmRuntime();
    -    properties.setMavenProperty(Property.IVY_TEST_VM_RUNTIME, tstVmDir.getAbsolutePath());
    +    var tstVmDir = createTestVmRuntime();
    +    properties.setMavenProperty(Property.IVY_TEST_VM_RUNTIME, tstVmDir.toAbsolutePath().toString());
       }
     
    -  private File createTestVmRuntime() throws MojoExecutionException {
    +  private Path createTestVmRuntime() throws MojoExecutionException {
         IvyTestRuntime testRuntime = new IvyTestRuntime();
    -    testRuntime.setProductDir(identifyAndGetEngineDirectory());
    +    testRuntime.setProductDir(identifyAndGetEngineDirectory().toPath());
         testRuntime.setProjectLocations(getProjects());
         try {
           return testRuntime.store(project);
    @@ -114,10 +115,11 @@ private File createTestVmRuntime() throws MojoExecutionException {
       }
     
       private List getProjects() {
    -    List deps = new ArrayList<>();
    -    deps.add(project.getBasedir());
    +    var deps = new ArrayList();
    +    deps.add(project.getBasedir().toPath());
         deps.addAll(MavenRuntime.getDependencies(project, session, "iar"));
         return deps.stream()
    +            .map(Path::toFile)
                 .map(file -> file.toURI())
                 .collect(Collectors.toList());
       }
    @@ -134,7 +136,7 @@ private void configureMavenTestProperties(MavenProperties properties) throws Moj
                 .map(property -> "${" + property + "}")
                 .collect(Collectors.joining(","));
         properties.setMavenProperty(Property.MAVEN_TEST_ADDITIONAL_CLASSPATH, surefireClasspath);
    -    properties.append(Property.MAVEN_TEST_ARGLINE, EngineModuleHints.loadFromJvmOptionsFile(identifyAndGetEngineDirectory(), getLog()));
    +    properties.append(Property.MAVEN_TEST_ARGLINE, EngineModuleHints.loadFromJvmOptionsFile(identifyAndGetEngineDirectory().toPath(), getLog()));
       }
     
       private void setTestOutputDirectory() {
    diff --git a/src/main/java/ch/ivyteam/ivy/maven/test/StartTestEngineMojo.java b/src/main/java/ch/ivyteam/ivy/maven/test/StartTestEngineMojo.java
    index 879e8660..633c04cc 100644
    --- a/src/main/java/ch/ivyteam/ivy/maven/test/StartTestEngineMojo.java
    +++ b/src/main/java/ch/ivyteam/ivy/maven/test/StartTestEngineMojo.java
    @@ -16,7 +16,6 @@
     
     package ch.ivyteam.ivy.maven.test;
     
    -import java.io.File;
     import java.io.IOException;
     import java.nio.file.Files;
     import java.nio.file.Path;
    @@ -36,14 +35,14 @@
     
     /**
      * Starts the Axon Ivy Engine for integration testing.
    - * 
    + *
      * 

    * After starting the engine, this goal provides the url of the engine as * property test.engine.url. You can use this property to configure * your 'maven-failsafe-plugin' to work against this test engine. However, in an * iar-integration-test lifecycle this is already provided by the * 'ivy-integration-test-properties' goal. - * + * *

      * {@code
      *   maven-failsafe-plugin
    @@ -53,7 +52,7 @@
      *   
      * }
      * 
    - * + * * @since 6.2.0 */ @Mojo(name = StartTestEngineMojo.GOAL) @@ -83,7 +82,7 @@ public class StartTestEngineMojo extends AbstractIntegrationTestMojo { /** The file where the engine start is logged **/ @Parameter(property = "ivy.engine.start.log", required = false, defaultValue = "${project.build.directory}/testEngineOut.log") - File engineLogFile; + Path engineLogFile; /** The maximum amount of seconds that we wait for a engine to start */ @Parameter(property = IVY_ENGINE_START_TIMEOUT_SECONDS, defaultValue = "120") @@ -108,21 +107,21 @@ public void execute() throws MojoExecutionException, MojoFailureException { } public Executor startEngine() throws Exception { - File engineDir = identifyAndGetEngineDirectory(); + var engineDir = identifyAndGetEngineDirectory(); if (engineToTarget()) { - engineDir = copyEngineToTarget(engineDir); + engineDir = copyEngineToTarget(engineDir.toPath()).toFile(); } EngineVmOptions vmOptions = new EngineVmOptions(maxmem, additionalClasspath, additionalVmOptions); EngineControl engineControl = new EngineControl(new EngineMojoContext( - engineDir, project, getLog(), engineLogFile, vmOptions, startTimeoutInSeconds)); + engineDir.toPath(), project, getLog(), engineLogFile, vmOptions, startTimeoutInSeconds)); return engineControl.start(); } - private File copyEngineToTarget(File cachedEngineDir) { - File targetEngine = getTargetDir(project); - if (targetEngine.exists()) { + private Path copyEngineToTarget(Path cachedEngineDir) { + var targetEngine = getTargetDir(project); + if (Files.exists(targetEngine)) { getLog().warn("Skipping copy of engine to " + targetEngine + " it already exists. Use \"mvn clean\" to ensure a clean engine each cycle."); return targetEngine; @@ -132,7 +131,7 @@ private File copyEngineToTarget(File cachedEngineDir) { getLog().info("Parameter is set to " + testEngine + ", copying engine from: " + cachedEngineDir + " to " + targetEngine); - copyEngine(cachedEngineDir.toPath(), targetEngine.toPath()); + copyEngine(cachedEngineDir, targetEngine); return targetEngine; } catch (IOException ex) { getLog().warn("Could not copy engine from: " + cachedEngineDir + " to " + targetEngine, ex); diff --git a/src/main/java/ch/ivyteam/ivy/maven/test/StopTestEngineMojo.java b/src/main/java/ch/ivyteam/ivy/maven/test/StopTestEngineMojo.java index 79f8ee7c..fac24090 100644 --- a/src/main/java/ch/ivyteam/ivy/maven/test/StopTestEngineMojo.java +++ b/src/main/java/ch/ivyteam/ivy/maven/test/StopTestEngineMojo.java @@ -16,8 +16,6 @@ package ch.ivyteam.ivy.maven.test; -import java.io.File; - import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; @@ -30,7 +28,7 @@ /** * Stops the Axon Ivy Engine after integration testing - * + * * @since 6.2.0 */ @Mojo(name = StopTestEngineMojo.GOAL) @@ -78,14 +76,14 @@ public void execute() throws MojoExecutionException, MojoFailureException { } public EngineControl createEngineController() throws MojoExecutionException { - File engineDir = getEngineDir(project); + var engineDir = getEngineDir(project); if (engineDir == null || !engineDir.exists()) { engineDir = identifyAndGetEngineDirectory(); } EngineVmOptions vmOptions = new EngineVmOptions(maxmem, additionalClasspath, additionalVmOptions); EngineControl engineControl = new EngineControl(new EngineMojoContext( - engineDir, project, getLog(), null, vmOptions, stopTimeoutInSeconds)); + engineDir.toPath(), project, getLog(), null, vmOptions, stopTimeoutInSeconds)); return engineControl; } diff --git a/src/main/java/ch/ivyteam/ivy/maven/test/bpm/IvyTestRuntime.java b/src/main/java/ch/ivyteam/ivy/maven/test/bpm/IvyTestRuntime.java index c713b032..12745984 100644 --- a/src/main/java/ch/ivyteam/ivy/maven/test/bpm/IvyTestRuntime.java +++ b/src/main/java/ch/ivyteam/ivy/maven/test/bpm/IvyTestRuntime.java @@ -1,10 +1,9 @@ package ch.ivyteam.ivy.maven.test.bpm; -import java.io.File; -import java.io.FileOutputStream; import java.io.IOException; -import java.io.OutputStream; import java.net.URI; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.List; import java.util.Properties; import java.util.stream.Collectors; @@ -12,6 +11,7 @@ import org.apache.maven.project.MavenProject; public class IvyTestRuntime { + public static final String RUNTIME_PROPS_RESOURCE = "ivyTestRuntime.properties"; public static interface Key { @@ -21,8 +21,8 @@ public static interface Key { private final Properties props = new Properties(); - public void setProductDir(File engineDir) { - props.put(Key.PRODUCT_DIR, engineDir.getAbsolutePath()); + public void setProductDir(Path engineDir) { + props.put(Key.PRODUCT_DIR, engineDir.toAbsolutePath().toString()); } public void setProjectLocations(List locations) { @@ -34,20 +34,18 @@ public void setProjectLocations(List locations) { props.setProperty(Key.PROJECT_LOCATIONS, joinedUris); } - public File store(MavenProject project) throws IOException { - File target = new File(project.getBuild().getDirectory()); - File tstVmDir = new File(target, "ivyTestVm"); - tstVmDir.mkdir(); + public Path store(MavenProject project) throws IOException { + var tstVmDir = Path.of(project.getBuild().getDirectory()).resolve("ivyTestVm"); + Files.createDirectories(tstVmDir); store(tstVmDir); return tstVmDir; } - private File store(File dir) throws IOException { - File propsFile = new File(dir, RUNTIME_PROPS_RESOURCE); - try (OutputStream os = new FileOutputStream(propsFile)) { - props.store(os, "ivy test vm runtime properties"); + private Path store(Path dir) throws IOException { + var propsFile = dir.resolve(RUNTIME_PROPS_RESOURCE); + try (var out = Files.newOutputStream(propsFile)) { + props.store(out, "ivy test vm runtime properties"); } return propsFile; } - } diff --git a/src/main/java/ch/ivyteam/ivy/maven/util/CompilerResult.java b/src/main/java/ch/ivyteam/ivy/maven/util/CompilerResult.java index 04a2ec88..39e6850e 100644 --- a/src/main/java/ch/ivyteam/ivy/maven/util/CompilerResult.java +++ b/src/main/java/ch/ivyteam/ivy/maven/util/CompilerResult.java @@ -16,10 +16,8 @@ package ch.ivyteam.ivy.maven.util; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; import java.io.IOException; +import java.nio.file.Files; import java.util.Map; import java.util.Map.Entry; import java.util.Properties; @@ -38,17 +36,17 @@ public static void store(Map result, MavenProject project) throw for (Entry entry : result.entrySet()) { properties.setProperty(entry.getKey(), entry.getValue().toString()); } - File propertyFile = new SharedFile(project).getCompileResultProperties(); - try (FileOutputStream fos = new FileOutputStream(propertyFile)) { - properties.store(fos, "ivy project build results"); + var propertyFile = new SharedFile(project).getCompileResultProperties(); + try (var out = Files.newOutputStream(propertyFile)) { + properties.store(out, "ivy project build results"); } } public static CompilerResult load(MavenProject project) throws IOException { - File propertyFile = new SharedFile(project).getCompileResultProperties(); + var propertyFile = new SharedFile(project).getCompileResultProperties(); Properties compileResults = new Properties(); - try (FileInputStream fis = new FileInputStream(propertyFile)) { - compileResults.load(fis); + try (var in = Files.newInputStream(propertyFile)) { + compileResults.load(in); } return new CompilerResult(compileResults); } @@ -65,5 +63,4 @@ public String getTestOutputDirectory() { } return result.getProperty(Result.TEST_OUTPUT_DIR); } - -} \ No newline at end of file +} diff --git a/src/main/java/ch/ivyteam/ivy/maven/util/MavenDependencies.java b/src/main/java/ch/ivyteam/ivy/maven/util/MavenDependencies.java index ac67d055..da53b170 100644 --- a/src/main/java/ch/ivyteam/ivy/maven/util/MavenDependencies.java +++ b/src/main/java/ch/ivyteam/ivy/maven/util/MavenDependencies.java @@ -1,6 +1,7 @@ package ch.ivyteam.ivy.maven.util; import java.io.File; +import java.nio.file.Path; import java.util.List; import java.util.Objects; import java.util.Optional; @@ -30,11 +31,12 @@ public MavenDependencies type(String newTypeFilter) { return this; } - public List localTransient() { + public List localTransient() { return stream(project.getArtifacts()) .filter(this::isLocalDep) .filter(this::include) .map(Artifact::getFile) + .map(File::toPath) .filter(Objects::nonNull) .collect(Collectors.toList()); } @@ -47,10 +49,11 @@ private boolean isLocalDep(Artifact artifact) { .isEmpty(); } - public List all() { + public List all() { return stream(project.getArtifacts()) .filter(this::include) .map(this::toFile) + .map(File::toPath) .collect(Collectors.toList()); } diff --git a/src/main/java/ch/ivyteam/ivy/maven/util/MavenRuntime.java b/src/main/java/ch/ivyteam/ivy/maven/util/MavenRuntime.java index 0b8833e3..e27f6940 100644 --- a/src/main/java/ch/ivyteam/ivy/maven/util/MavenRuntime.java +++ b/src/main/java/ch/ivyteam/ivy/maven/util/MavenRuntime.java @@ -1,17 +1,18 @@ package ch.ivyteam.ivy.maven.util; -import java.io.File; +import java.nio.file.Path; import java.util.List; import org.apache.maven.execution.MavenSession; import org.apache.maven.project.MavenProject; public class MavenRuntime { - public static List getDependencies(MavenProject project, String type) { + + public static List getDependencies(MavenProject project, String type) { return getDependencies(project, null, type); } - public static List getDependencies(MavenProject project, MavenSession session, String type) { + public static List getDependencies(MavenProject project, MavenSession session, String type) { return new MavenDependencies(project, session).type(type).all(); } } diff --git a/src/main/java/ch/ivyteam/ivy/maven/util/SharedFile.java b/src/main/java/ch/ivyteam/ivy/maven/util/SharedFile.java index 90374b02..1c9c65d8 100644 --- a/src/main/java/ch/ivyteam/ivy/maven/util/SharedFile.java +++ b/src/main/java/ch/ivyteam/ivy/maven/util/SharedFile.java @@ -16,36 +16,36 @@ package ch.ivyteam.ivy.maven.util; -import java.io.File; +import java.nio.file.Path; import org.apache.maven.project.MavenProject; /** * A file that is used by multiple Mojos/Goals during the build lifecycle. - * + * * @since 6.0.3 */ public class SharedFile { - private File targetDir; + + private final Path targetDir; public SharedFile(MavenProject project) { - targetDir = new File(project.getBuild().getDirectory()); + targetDir = Path.of(project.getBuild().getDirectory()); } - public File getEngineOSGiBootClasspathJar() { - return new File(targetDir, "ivy.engine.osgi.boot.classpath.jar"); + public Path getEngineOSGiBootClasspathJar() { + return targetDir.resolve("ivy.engine.osgi.boot.classpath.jar"); } - public File getEngineClasspathJar() { - return new File(targetDir, "ivy.engine.classpath.jar"); + public Path getEngineClasspathJar() { + return targetDir.resolve("ivy.engine.classpath.jar"); } - public File getIarDependencyClasspathJar() { - return new File(targetDir, "ivy.project.dependency.classpath.jar"); + public Path getIarDependencyClasspathJar() { + return targetDir.resolve("ivy.project.dependency.classpath.jar"); } - public File getCompileResultProperties() { - return new File(targetDir, "ivy.project.compile.result.properties"); + public Path getCompileResultProperties() { + return targetDir.resolve("ivy.project.compile.result.properties"); } - } diff --git a/src/test/java/ch/ivyteam/ivy/maven/BaseEngineProjectMojoTest.java b/src/test/java/ch/ivyteam/ivy/maven/BaseEngineProjectMojoTest.java index a05d7379..cbec44a3 100644 --- a/src/test/java/ch/ivyteam/ivy/maven/BaseEngineProjectMojoTest.java +++ b/src/test/java/ch/ivyteam/ivy/maven/BaseEngineProjectMojoTest.java @@ -179,7 +179,7 @@ protected void before() throws Throwable { } private void provideClasspathJar() throws IOException { - File cpJar = new SharedFile(project).getEngineOSGiBootClasspathJar(); + var cpJar = new SharedFile(project).getEngineOSGiBootClasspathJar().toFile(); new ClasspathJar(cpJar).createFileEntries(EngineClassLoaderFactory .getOsgiBootstrapClasspath(installUpToDateEngineRule.getMojo().getRawEngineDirectory())); } diff --git a/src/test/java/ch/ivyteam/ivy/maven/TestInstallEngineMojo.java b/src/test/java/ch/ivyteam/ivy/maven/TestInstallEngineMojo.java index 8bc523fc..61d29fc7 100644 --- a/src/test/java/ch/ivyteam/ivy/maven/TestInstallEngineMojo.java +++ b/src/test/java/ch/ivyteam/ivy/maven/TestInstallEngineMojo.java @@ -243,10 +243,10 @@ public void testEngineDownload_overProxy() throws Exception { } downloader.proxies = this::localTestProxy; - File downloaded = downloader.downloadEngine(); + var downloaded = downloader.downloadEngine(); assertThat(downloaded) - .as("served file via proxy") - .exists(); + .as("served file via proxy") + .exists(); } private ProxyInfo localTestProxy(@SuppressWarnings("unused") String protocol) { diff --git a/src/test/java/ch/ivyteam/ivy/maven/deploy/TestDeployToEngineMojo.java b/src/test/java/ch/ivyteam/ivy/maven/deploy/TestDeployToEngineMojo.java index 721700df..5c2f6f0f 100644 --- a/src/test/java/ch/ivyteam/ivy/maven/deploy/TestDeployToEngineMojo.java +++ b/src/test/java/ch/ivyteam/ivy/maven/deploy/TestDeployToEngineMojo.java @@ -20,8 +20,8 @@ import java.io.File; import java.io.IOException; -import java.nio.charset.StandardCharsets; import java.nio.file.Files; +import java.nio.file.Path; import java.util.concurrent.Callable; import java.util.concurrent.TimeUnit; @@ -34,13 +34,13 @@ import ch.ivyteam.ivy.maven.engine.deploy.dir.DeploymentFiles; public class TestDeployToEngineMojo { + @Test public void deployPackedIar() throws Throwable { DeployToEngineMojo mojo = rule.getMojo(); - File deployedIar = getTarget(mojo.deployFile, mojo); - File deploymentOptionsFile = new File(deployedIar.getParentFile(), - deployedIar.getName() + "options.yaml"); + var deployedIar = getTarget(mojo.deployFile, mojo); + var deploymentOptionsFile = deployedIar.resolveSibling(deployedIar.getFileName() + ".options.yaml"); assertThat(deployedIar).doesNotExist(); assertThat(deploymentOptionsFile).doesNotExist(); @@ -49,7 +49,7 @@ public void deployPackedIar() throws Throwable { Callable engineOperation = () -> { assertThat(deploymentOptionsFile).doesNotExist(); assertThat(deployedIar).exists(); - deployedIar.delete(); + Files.delete(deployedIar); return null; }; mockEngineDeployThread.execute(engineOperation); @@ -66,10 +66,9 @@ public void deployWithExistingOptionsFile() throws Throwable { rule.project.getProperties().setProperty("doDeploy.test.user", "true"); DeployToEngineMojo mojo = rule.getMojo(); - mojo.deployOptionsFile = new File("src/test/resources/options.yaml"); - File deployedIar = getTarget(mojo.deployFile, mojo); - File deploymentOptionsFile = new File(deployedIar.getParentFile(), - deployedIar.getName() + ".options.yaml"); + mojo.deployOptionsFile = Path.of("src/test/resources/options.yaml"); + var deployedIar = getTarget(mojo.deployFile, mojo); + var deploymentOptionsFile = deployedIar.resolveSibling(deployedIar.getFileName() + ".options.yaml"); assertThat(deployedIar).doesNotExist(); assertThat(deploymentOptionsFile).doesNotExist(); @@ -78,9 +77,9 @@ public void deployWithExistingOptionsFile() throws Throwable { Callable engineOperation = () -> { assertThat(deploymentOptionsFile).exists(); assertThat(deploymentOptionsFile).hasContent("deployTestUsers: true\ntarget: AUTO"); - deploymentOptionsFile.delete(); + Files.delete(deploymentOptionsFile); assertThat(deployedIar).exists(); - Files.delete(deployedIar.toPath()); + Files.delete(deployedIar); return null; }; mockEngineDeployThread.execute(engineOperation); @@ -100,9 +99,8 @@ public void deployWithOptions() throws Throwable { mojo.deployTargetState = "INACTIVE"; mojo.deployTargetFileFormat = "EXPANDED"; - File deployedIar = getTarget(mojo.deployFile, mojo); - File deploymentOptionsFile = new File(deployedIar.getParentFile(), - deployedIar.getName() + ".options.yaml"); + var deployedIar = getTarget(mojo.deployFile, mojo); + var deploymentOptionsFile = deployedIar.resolveSibling(deployedIar.getFileName() + ".options.yaml"); assertThat(deployedIar).doesNotExist(); assertThat(deploymentOptionsFile).doesNotExist(); @@ -111,14 +109,15 @@ public void deployWithOptions() throws Throwable { Callable engineOperation = () -> { assertThat(deploymentOptionsFile).exists(); assertThat(deploymentOptionsFile).hasContent( - "deployTestUsers: \"TRUE\"\n" + - "target:\n" + - " version: RELEASED\n" + - " state: INACTIVE\n" + - " fileFormat: EXPANDED"); - deploymentOptionsFile.delete(); + """ + deployTestUsers: "TRUE" + target: + version: RELEASED + state: INACTIVE + fileFormat: EXPANDED"""); + Files.delete(deploymentOptionsFile); assertThat(deployedIar).exists(); - Files.delete(deployedIar.toPath()); + Files.delete(deployedIar); return null; }; mockEngineDeployThread.execute(engineOperation); @@ -134,13 +133,13 @@ public void deployWithOptions() throws Throwable { public void failOnEngineDeployError() throws Throwable { DeployToEngineMojo mojo = rule.getMojo(); DeploymentFiles markers = new DeploymentFiles(getTarget(mojo.deployFile, mojo)); - File deployedIar = getTarget(mojo.deployFile, mojo); + var deployedIar = getTarget(mojo.deployFile, mojo); DelayedOperation mockEngineDeployThread = new DelayedOperation(500, TimeUnit.MILLISECONDS); Callable engineOperation = () -> { - FileUtils.write(markers.errorLog(), "validation errors", StandardCharsets.UTF_8); + Files.writeString(markers.errorLog(), "validation errors"); assertThat(deployedIar).exists(); - deployedIar.delete(); + Files.delete(deployedIar); return null; }; @@ -155,11 +154,11 @@ public void failOnEngineDeployError() throws Throwable { } } - private static File getTarget(File iar, DeployToEngineMojo mojo) { - File deploy = new File(mojo.deployEngineDirectory, mojo.deployDirectory); - File app = new File(deploy, mojo.deployToEngineApplication); - File deployedIar = new File(app, iar.getName()); - return deployedIar; + private static Path getTarget(Path iar, DeployToEngineMojo mojo) { + return mojo.deployEngineDirectory + .resolve(mojo.deployDirectory) + .resolve(mojo.deployToEngineApplication) + .resolve(iar.getFileName().toString()); } @Rule @@ -169,14 +168,14 @@ private static File getTarget(File iar, DeployToEngineMojo mojo) { protected void before() throws Throwable { super.before(); - getMojo().deployEngineDirectory = createEngineDir(); + getMojo().deployEngineDirectory = createEngineDir().toPath(); getMojo().deployToEngineApplication = "TestApp"; try { - getMojo().deployFile.getParentFile().mkdir(); - getMojo().deployFile.createNewFile(); + getMojo().deployFile.toFile().getParentFile().mkdir(); + getMojo().deployFile.toFile().createNewFile(); } catch (IOException ex) { - System.err.println("Failed to create IAR @ " + getMojo().deployFile.getAbsolutePath()); + System.err.println("Failed to create IAR @ " + getMojo().deployFile.toAbsolutePath()); throw ex; } } @@ -191,7 +190,7 @@ private File createEngineDir() { @Override protected void after() { super.after(); - FileUtils.deleteQuietly(getMojo().deployEngineDirectory); + FileUtils.deleteQuietly(getMojo().deployEngineDirectory.toFile()); } }; diff --git a/src/test/java/ch/ivyteam/ivy/maven/deploy/TestDeployToRunningEngine.java b/src/test/java/ch/ivyteam/ivy/maven/deploy/TestDeployToRunningEngine.java index af7125ef..fba9e565 100644 --- a/src/test/java/ch/ivyteam/ivy/maven/deploy/TestDeployToRunningEngine.java +++ b/src/test/java/ch/ivyteam/ivy/maven/deploy/TestDeployToRunningEngine.java @@ -21,6 +21,7 @@ import java.io.ByteArrayOutputStream; import java.io.File; import java.io.PrintStream; +import java.nio.file.Path; import org.apache.commons.exec.Executor; import org.apache.maven.plugin.MojoExecutionException; @@ -52,9 +53,9 @@ public void setup() throws MojoExecutionException { mojo = rule.getMojo(); deployMojo = deployRule.getMojo(); deployMojo.deployToEngineApplication = "MyTestApp"; - deployMojo.deployEngineDirectory = mojo.getEngineDir(mojo.project); + deployMojo.deployEngineDirectory = mojo.getEngineDir(mojo.project).toPath(); deployMojo.deployTimeoutInSeconds = 120; - deployMojo.deployFile = new File("src/test/resources/deploy-single-7.1.0-SNAPSHOT.iar"); + deployMojo.deployFile = Path.of("src/test/resources/deploy-single-7.1.0-SNAPSHOT.iar"); deployMojo.deployTestUsers = "true"; System.setOut(new PrintStream(outContent)); @@ -68,22 +69,17 @@ public void restoreStreams() { @Test public void canDeployIar() throws Exception { deployMojo.deployToEngineApplication = "Portal"; - - File deployedIar = getTarget(deployMojo.deployFile, deployMojo); - File deployedIarFlagFile = new File(deployedIar.getParent(), deployedIar.getName() + ".deployed"); - File deployedIarLogFile = new File(deployedIar.getParent(), deployedIar.getName() + ".deploymentLog"); - + var deployedIar = getTarget(deployMojo.deployFile, deployMojo); + var deployedIarFlagFile = deployedIar.resolveSibling(deployedIar.getFileName() + ".deployed"); + var deployedIarLogFile = deployedIar.resolveSibling(deployedIar.getFileName() + ".deploymentLog"); Executor startedProcess = null; try { startedProcess = mojo.startEngine(); - deployMojo.execute(); - assertThat(deployedIar).doesNotExist(); assertThat(deployedIarFlagFile).exists(); assertThat(deployedIarLogFile).exists(); - assertThat(linesOf(deployedIarLogFile)).haveAtLeast(1, - new Condition<>(s -> s.contains("Deploying users ..."), "")); + assertThat(linesOf(deployedIarLogFile)).haveAtLeast(1, new Condition<>(s -> s.contains("Deploying users ..."), "")); } finally { kill(startedProcess); } @@ -140,11 +136,11 @@ private void deployIarRemoteAndAssert() throws Exception, MojoExecutionException } } - private static File getTarget(File iar, DeployToEngineMojo mojo) { - File deploy = new File(mojo.deployEngineDirectory, mojo.deployDirectory); - File app = new File(deploy, mojo.deployToEngineApplication); - File deployedIar = new File(app, iar.getName()); - return deployedIar; + private static Path getTarget(Path iar, DeployToEngineMojo mojo) { + return mojo.deployEngineDirectory + .resolve(mojo.deployDirectory) + .resolve(mojo.deployToEngineApplication) + .resolve(iar.getFileName().toString()); } private static void kill(Executor startedProcess) { diff --git a/src/test/java/ch/ivyteam/ivy/maven/deploy/TestDeployToTestEngineMojo.java b/src/test/java/ch/ivyteam/ivy/maven/deploy/TestDeployToTestEngineMojo.java index c6157ef9..b1802db9 100644 --- a/src/test/java/ch/ivyteam/ivy/maven/deploy/TestDeployToTestEngineMojo.java +++ b/src/test/java/ch/ivyteam/ivy/maven/deploy/TestDeployToTestEngineMojo.java @@ -51,19 +51,19 @@ public void autoAppZip() throws ArchiverException, IOException { Files.createDirectories(builtTarget); Files.createFile(builtTarget.resolve("alreadyPacked.iar")); - File appZip = mojo.createFullAppZip(List.of( - Files.createFile(workspace.resolve("demo.iar")).toFile(), - Files.createFile(workspace.resolve("demoTest.iar")).toFile(), - reactorProject.toFile(), - builtTarget.getParent().toFile())); - assertThat(appZip.getName()).isEqualTo("myApp-app.zip"); + var appZip = mojo.createFullAppZip(List.of( + Files.createFile(workspace.resolve("demo.iar")), + Files.createFile(workspace.resolve("demoTest.iar")), + reactorProject, + builtTarget.getParent())); + assertThat(appZip.getFileName().toString()).isEqualTo("myApp-app.zip"); assertThat(DeployToTestEngineMojo.findPackedIar(builtTarget.getParent().toFile())).isPresent(); assertThat(getRootFiles(appZip)) .containsOnly("demo.iar", "demoTest.iar", "myReactorProject", "alreadyPacked.iar"); } - private static List getRootFiles(File zip) throws IOException { - java.net.URI uri = java.net.URI.create("jar:" + zip.toPath().toUri()); + private static List getRootFiles(Path zip) throws IOException { + java.net.URI uri = java.net.URI.create("jar:" + zip.toUri()); try (FileSystem zipFsCr = FileSystems.newFileSystem(uri, Collections.emptyMap())) { Path root = zipFsCr.getPath("/"); try (Stream paths = Files.list(root)) { diff --git a/src/test/java/ch/ivyteam/ivy/maven/engine/TestEngineVersionEvaluator.java b/src/test/java/ch/ivyteam/ivy/maven/engine/TestEngineVersionEvaluator.java index ca73b89b..f5bd6962 100644 --- a/src/test/java/ch/ivyteam/ivy/maven/engine/TestEngineVersionEvaluator.java +++ b/src/test/java/ch/ivyteam/ivy/maven/engine/TestEngineVersionEvaluator.java @@ -18,13 +18,13 @@ class TestEngineVersionEvaluator { @Test void isOSGiEngine_invalid() { - assertThat(EngineVersionEvaluator.isOSGiEngine(tempDir.toFile())).isFalse(); + assertThat(EngineVersionEvaluator.isOSGiEngine(tempDir)).isFalse(); } @Test void isOSGiEngine_valid() throws IOException { var systemDir = tempDir.resolve(OsgiDir.INSTALL_AREA); Files.createDirectories(systemDir); - assertThat(EngineVersionEvaluator.isOSGiEngine(tempDir.toFile())).isTrue(); + assertThat(EngineVersionEvaluator.isOSGiEngine(tempDir)).isTrue(); } } diff --git a/src/test/java/ch/ivyteam/ivy/maven/engine/deploy/dir/TestFileLogForwarder.java b/src/test/java/ch/ivyteam/ivy/maven/engine/deploy/dir/TestFileLogForwarder.java index 3d91dcc8..09e960da 100644 --- a/src/test/java/ch/ivyteam/ivy/maven/engine/deploy/dir/TestFileLogForwarder.java +++ b/src/test/java/ch/ivyteam/ivy/maven/engine/deploy/dir/TestFileLogForwarder.java @@ -40,7 +40,7 @@ void fileToMavenLog() throws Exception { var fakeEngineLog = tempDir.resolve("myProject.iar.deploymentLog"); Files.createFile(fakeEngineLog); var mavenLog = new LogCollector(); - var logForwarder = new FileLogForwarder(fakeEngineLog.toFile(), mavenLog, new EngineLogLineHandler(mavenLog)); + var logForwarder = new FileLogForwarder(fakeEngineLog, mavenLog, new EngineLogLineHandler(mavenLog)); var log = new FakeLogger(fakeEngineLog); try { diff --git a/src/test/java/ch/ivyteam/ivy/maven/test/TestSetupIvyTestPropertiesMojo.java b/src/test/java/ch/ivyteam/ivy/maven/test/TestSetupIvyTestPropertiesMojo.java index ddc22a82..573bfca3 100644 --- a/src/test/java/ch/ivyteam/ivy/maven/test/TestSetupIvyTestPropertiesMojo.java +++ b/src/test/java/ch/ivyteam/ivy/maven/test/TestSetupIvyTestPropertiesMojo.java @@ -24,6 +24,7 @@ import java.net.URL; import java.net.URLClassLoader; import java.nio.file.Files; +import java.nio.file.Path; import java.util.Arrays; import java.util.HashMap; import java.util.Map; @@ -105,10 +106,10 @@ public void ivyTestRuntimeClasspathResource() throws Exception { @Test public void ivyTestRuntimeIO() throws IOException { - IvyTestRuntime rt = new IvyTestRuntime(); - rt.setProductDir(new File("/tmp/myEngine")); - File ivyTestVm = rt.store(rule.project); - assertThat(ivyTestVm.getParentFile().getName()).isEqualTo("target"); + var rt = new IvyTestRuntime(); + rt.setProductDir(Path.of("/tmp/myEngine")); + var ivyTestVm = rt.store(rule.project); + assertThat(ivyTestVm.getParent().getFileName().toString()).isEqualTo("target"); } @Rule @@ -127,7 +128,7 @@ protected void before() throws Throwable { } private void writeTestClasspathJar() throws IOException { - File classPathJar = new SharedFile(getMojo().project).getEngineClasspathJar(); + var classPathJar = new SharedFile(getMojo().project).getEngineClasspathJar().toFile(); new ClasspathJar(classPathJar).createFileEntries(Arrays.asList( Files.createTempFile("dummy", ".jar").toFile(), Files.createTempFile("dummy2", ".jar").toFile()));