Skip to content

Commit

Permalink
šŸµšŸ¶šŸ»
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsuter committed Jul 22, 2024
1 parent cd5cf2e commit e7ffd63
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
17 changes: 5 additions & 12 deletions src/main/java/ch/ivyteam/ivy/maven/deploy/AbstractDeployMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <deployEngineDirectory>.");
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,14 @@ static Optional<Path> 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();
}
}

0 comments on commit e7ffd63

Please sign in to comment.