OpenLiberty / ci.ant

Ant tasks for managing Liberty profile server instances #devops
Apache License 2.0
8 stars 36 forks source link

handle embedded spaces in archive path #116

Closed cherylking closed 5 years ago

cherylking commented 5 years ago

This fix attempts to resolve issue https://github.com/OpenLiberty/ci.maven/issues/677.

cherylking commented 5 years ago

First attempt at fix resulted in this error: command.add("--archive=" + "\\\"" + archivePath + "\\\"");

[INFO] [INFO] CWWKM2001I: Invoke command is ["C:\projects\ci-maven\liberty-maven-plugin\target\it\package-type-config-with space-it\target\liberty\wlp\bin\server.bat", package, test, --archive=\"C:\projects\ci-maven\liberty-maven-plugin\target\it\package-type-config-with space-it\target\package-type-config-with-space-it.jar\", --include=runnable].
[INFO] [INFO] Packaging server test.
[INFO] [INFO] CWWKE0056E: Unable to zip up directory due to an IO exception java.io.IOException: java.lang.reflect.InvocationTargetException. 

I'm going to attempt quoting the whole argument myself and see what happens.

cherylking commented 5 years ago

Second attempt also failed: command.add("\"--archive=\\\"" + archivePath + "\\\"\"");

[INFO] [INFO] CWWKM2001I: Invoke command is ["C:\projects\ci-maven\liberty-maven-plugin\target\it\package-type-config-with space-it\target\liberty\wlp\bin\server.bat", package, test, "--archive=\"C:\projects\ci-maven\liberty-maven-plugin\target\it\package-type-config-with space-it\target\package-type-config-with-space-it.jar\"", --include=runnable].
[INFO] [INFO] Packaging server test.
[INFO] [INFO] CWWKE0056E: Unable to zip up directory due to an IO exception java.io.IOException: java.lang.reflect.InvocationTargetException. 
[INFO] [INFO] Server test package failed. Check server logs for details.
cherylking commented 5 years ago

The original code results in the reported error:

command.add("--archive=" + "\"" + archivePath + "\"");

[INFO] [INFO] CWWKM2001I: Invoke command is ["C:\projects\ci-maven\liberty-maven-plugin\target\it\package-type-config-with space-it\target\liberty\wlp\bin\server.bat", package, test, --archive="C:\projects\ci-maven\liberty-maven-plugin\target\it\package-type-config-with space-it\target\package-type-config-with-space-it.jar", --include=runnable].
[INFO] [INFO] CWWKE0027W: Only one server may be specified on the command line; subsequent names will be ignored (server=test, ignored=space-it\target\package-type-config-with-space-it.jar).
[INFO] [INFO] Packaging server test.
[INFO] [INFO] Server test package complete in C:\projects\ci-maven\liberty-maven-plugin\target\it\package-type-config-with.jar.
cherylking commented 5 years ago

Last commit finally resulted in a successful package command. command.add("\"--archive=" + archivePath + "\"");

[INFO] [INFO] CWWKM2001I: Invoke command is ["C:\projects\ci-maven\liberty-maven-plugin\target\it\package-type-config-with space-it\target\liberty\wlp\bin\server.bat", package, test, "--archive=C:\projects\ci-maven\liberty-maven-plugin\target\it\package-type-config-with space-it\target\package-type-config-with-space-it.jar", --include=runnable].
[INFO] [INFO] Packaging server test.
[INFO] [INFO] Server test package complete in C:\projects\ci-maven\liberty-maven-plugin\target\it\package-type-config-with space-it\target\package-type-config-with-space-it.jar.