metro-jax-ws icon indicating copy to clipboard operation
metro-jax-ws copied to clipboard

jaxws-maven-plugin fails with space in temp path

Open palbr opened this issue 9 months ago • 0 comments

On a Windows machine, I have a maven project with following pom.xml:

<project>
    <!-- ... -->
    <build>
        <plugins>
            <plugin>
                <groupId>com.sun.xml.ws</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
                <version>2.3.7</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>wsimport</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <wsdlDirectory>${project.basedir}/src/main/resources/META-INF/wsdl</wsdlDirectory>
                    <wsdlFiles>
                        <wsdlFile>myService.wsdl</wsdlFile>
                    </wsdlFiles>
                    <xdebug>true</xdebug>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

If the maven build process uses a temp path with spaces, like C:\MyTemp with Spaces\, the jaxws-maven-plugin throws the following exception:

Exception in thread "main" java.io.FileNotFoundException: C:\MyTemp (Das System kann die angegebene Datei nicht finden)
	at java.base/java.io.FileInputStream.open0(Native Method)
	at java.base/java.io.FileInputStream.open(FileInputStream.java:216)
	at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
	at org.jvnet.jax_ws_commons.jaxws.Invoker.main(Invoker.java:49)

The line above this exception is:

[DEBUG] cmd.exe /X /C ""C:\Program Files\jdk-17\bin\java.exe" -cp /C:/maven-repository/com/sun/xml/ws/jaxws-maven-plugin/2.3.7/jaxws-maven-plugin-2.3.7.jar org.jvnet.jax_ws_commons.jaxws.Invoker com.sun.tools.ws.wscompile.WsimportTool -pathfile C:\MyTemp with Spaces\jax-ws-mvn-plugin-cp2979622311834687376.txt -keep -s C:\MyProject\target\generated-sources\wsimport -d C:\MyProject\target\classes -encoding UTF-8 -Xnocompile -Xdebug file:/C:/MyProject/src/main/resources/META-INF/wsdl/myService.wsdl"

You can see that the value for -pathfile is not properly quoted or escaped.

You can set the temp path by adding "-Djava.io.tmpdir=C:\MyTemp with Spaces" to your mvn install command.

The build process works well, if I use a temp path without spaces. Like:

mvn clean install "-Djava.io.tmpdir=C:\MyTempWithoutSpaces" -e -X -f pom.xml

palbr avatar Jan 15 '25 16:01 palbr