From 2fac50dba28ee2632260276a6d7ea92f0a75b210 Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Fri, 12 Dec 2025 13:53:21 +0530 Subject: [PATCH 1/2] Adding option to path custom archive option for latest versions of liberty, which support POSIX paths Signed-off-by: Arun Venmany --- .../io/openliberty/tools/ant/ServerTask.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/openliberty/tools/ant/ServerTask.java b/src/main/java/io/openliberty/tools/ant/ServerTask.java index 20757d7f..a74d625a 100644 --- a/src/main/java/io/openliberty/tools/ant/ServerTask.java +++ b/src/main/java/io/openliberty/tools/ant/ServerTask.java @@ -88,6 +88,8 @@ public class ServerTask extends AbstractTask { private Map environmentVariables; private String serverRoot; + + private String customArchiveOption; @Override protected void initTask() { @@ -420,7 +422,11 @@ private int doStatusCmd(String cmd) throws Exception { private void doDump() throws Exception { List command = getInitialCommand(operation); - addArchiveOption(command); + if (customArchiveOption != null) { + command.add(customArchiveOption); + } else { + addArchiveOption(command); + } addIncludeOption(command); processBuilder.command(command); Process p = processBuilder.start(); @@ -437,7 +443,12 @@ private void doJavaDump() throws Exception { private void doPackage() throws Exception { List command = getInitialCommand(operation); - addArchiveOption(command); + if (customArchiveOption != null) { + command.add(customArchiveOption); + } else { + addArchiveOption(command); + } + addIncludeOption(command); addOsOption(command); addServerRootOption(command); @@ -685,4 +696,8 @@ public void setEnvironmentVariables(Map environmentVariables) { this.environmentVariables = environmentVariables; } + public void setCustomArchiveOption(String customArchiveOption) { + this.customArchiveOption = customArchiveOption; + } + } From ba73c16b7fca0d2cabbae1492220fcc2d285202e Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Fri, 19 Dec 2025 07:42:14 +0530 Subject: [PATCH 2/2] changes based on review comments Signed-off-by: Arun Venmany --- .../io/openliberty/tools/ant/ServerTask.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/java/io/openliberty/tools/ant/ServerTask.java b/src/main/java/io/openliberty/tools/ant/ServerTask.java index a74d625a..8c4fce51 100644 --- a/src/main/java/io/openliberty/tools/ant/ServerTask.java +++ b/src/main/java/io/openliberty/tools/ant/ServerTask.java @@ -89,7 +89,7 @@ public class ServerTask extends AbstractTask { private String serverRoot; - private String customArchiveOption; + private boolean usePosixRules = false; @Override protected void initTask() { @@ -422,11 +422,7 @@ private int doStatusCmd(String cmd) throws Exception { private void doDump() throws Exception { List command = getInitialCommand(operation); - if (customArchiveOption != null) { - command.add(customArchiveOption); - } else { - addArchiveOption(command); - } + addArchiveOption(command); addIncludeOption(command); processBuilder.command(command); Process p = processBuilder.start(); @@ -443,12 +439,7 @@ private void doJavaDump() throws Exception { private void doPackage() throws Exception { List command = getInitialCommand(operation); - if (customArchiveOption != null) { - command.add(customArchiveOption); - } else { - addArchiveOption(command); - } - + addArchiveOption(command); addIncludeOption(command); addOsOption(command); addServerRootOption(command); @@ -491,6 +482,7 @@ private void addArchiveOption(List command) { if (archive.isDirectory()) { throw new BuildException("The archive attribute must specify a file"); } + if (isWindows) { String archivePath = archive.toString(); if (archivePath.contains(" ")) { @@ -501,6 +493,11 @@ private void addArchiveOption(List command) { command.add("--archive=" + "\"" + archivePath + "\""); } } else { + if(isUsePosixRules()){ + command.add("--archive=" + archive.toString()); + log("Setting archive option based on latest POSIX rules"); + return; + } command.add("--archive=" + archive.toString().replaceAll(" ", "\\\\ ")); } } @@ -696,8 +693,11 @@ public void setEnvironmentVariables(Map environmentVariables) { this.environmentVariables = environmentVariables; } - public void setCustomArchiveOption(String customArchiveOption) { - this.customArchiveOption = customArchiveOption; + public boolean isUsePosixRules() { + return usePosixRules; } + public void setUsePosixRules(boolean usePosixRules) { + this.usePosixRules = usePosixRules; + } }