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 5630f1da..8d658b31 100644 --- a/src/main/java/ch/ivyteam/ivy/maven/deploy/AbstractDeployMojo.java +++ b/src/main/java/ch/ivyteam/ivy/maven/deploy/AbstractDeployMojo.java @@ -248,23 +248,16 @@ protected static final void removeTemporaryDeploymentOptionsFile(File deployment FileUtils.deleteQuietly(deploymentOptionsFile); } - protected final void deployToDirectory(File resolvedOptionsFile, File deployDir) + protected final void deployToDirectory(Path resolvedOptionsFile, Path deployDir) throws MojoExecutionException { 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); + String deployablePath = deployDir.relativize(targetDeployableFile).toString(); + IvyDeployer deployer = new FileDeployer(deployDir, resolvedOptionsFile, deployTimeoutInSeconds, deployFile, targetDeployableFile); deployer.deploy(deployablePath, getLog()); } - private Path toPath(File file) { - return file == null ? null : file.toPath(); - } - - private final Path createTargetDeployableFile(File deployDir) { - return deployDir.toPath() + private final Path createTargetDeployableFile(Path deployDir) { + return deployDir .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 fb5cfc8f..79dbe6ff 100644 --- a/src/main/java/ch/ivyteam/ivy/maven/deploy/DeployToEngineMojo.java +++ b/src/main/java/ch/ivyteam/ivy/maven/deploy/DeployToEngineMojo.java @@ -159,7 +159,7 @@ private void deployWithOptions(File resolvedOptionsFile) throws MojoExecutionExc } private void deployToDirectory(File resolvedOptionsFile) throws MojoExecutionException { - File deployDir = getDeployDirectory(); + var deployDir = getDeployDirectory(); if (deployEngineDirectory == null) { getLog().warn("Skipping deployment, target engine could not be evaluated." + "Please configure an existing engine to deploy to with argument ."); @@ -171,10 +171,12 @@ private void deployToDirectory(File resolvedOptionsFile) throws MojoExecutionExc + deployDir + "' does not exist."); return; } - checkDirParams(); + deployToDirectory(toPath(resolvedOptionsFile), deployDir.toPath()); + } - deployToDirectory(resolvedOptionsFile, deployDir); + private Path toPath(File file) { + return file == null ? null : file.toPath(); } private void deployToRestService(File resolvedOptionsFile) throws MojoExecutionException { 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 aec6ecae..7db79b86 100644 --- a/src/main/java/ch/ivyteam/ivy/maven/deploy/DeployToTestEngineMojo.java +++ b/src/main/java/ch/ivyteam/ivy/maven/deploy/DeployToTestEngineMojo.java @@ -153,11 +153,14 @@ static Optional findPackedIar(File dep) throws IOException { private void deployTestApp() throws MojoExecutionException { File resolvedOptionsFile = createDeployOptionsFile(new DeploymentOptionsFileFactory(deployFile)); try { - File deployDir = new File(getEngineDir(project), DeployToEngineMojo.DEPLOY_DEFAULT); - deployToDirectory(resolvedOptionsFile, deployDir); + var deployDir = getEngineDir(project).toPath().resolve(DeployToEngineMojo.DEPLOY_DEFAULT); + deployToDirectory(toPath(resolvedOptionsFile), deployDir); } finally { removeTemporaryDeploymentOptionsFile(resolvedOptionsFile); } } + private Path toPath(File file) { + return file == null ? null : file.toPath(); + } }