pass string with white space using commandlineArgs in maven commandlineArgs plugin
-
21-06-2021 - |
Frage
Is it possible to add double quote to the commandlineArgs of the maven mojo plugin?
On the batch i have %1 - getting just first part of the string until the first white space
I tried quot: " but it didnt help
e.g. <commandlineArgs>"path"</commandlineArgs>
I tried " ;
<commandlineArgs>"path"</commandlineArgs>
But i am getting:
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2:exec
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>export_objects</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>export_obj.bat</executable>
<commandlineArgs>###LONG PATH WITH SPACE###</commandlineArgs>
</configuration>
</plugin>
Lösung
Use XML CDATA:
<commandlineArgs><![CDATA[###LONG PATH WITH SPACE###]]></commandlineArgs>
or:
<arguments><argument><![CDATA[###LONG PATH WITH SPACE###]]></argument></arguments>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow