Skip to content

spring.bat can't work through proxy when pass -Dhttp.nonProxyHosts #9779

@liaoya

Description

@liaoya

I use springboot cli on windows, but my PC is behind a proxy, so that I set JAVA_OPTS before call spring.bat. I need escape "|" for batch file on Windows, you can refer http://www.robvanderwoude.com/escapechars.php or https://stackoverflow.com/questions/25744252/bypassing-non-proxy-hosts-in-java-opts

set JAVA_OPTS="-Dhttp.proxyHost=proxy.company -Dhttp.proxyPort=80 -Dhttp.nonProxyHosts=127.0.0.1^|localhost^|10.*  -Dhttps.proxyHost=proxy.company -Dhttps.proxyPort=80 -Dhttps.nonProxyHosts=127.0.0.1^|localhost^|10.*"

springboot cli fails and the error message is

Using service at https://start.spring.io
Failed to retrieve metadata from service at 'https://start.spring.io' (Connect to start.spring.io:443 [start.spring.io/104.17.47.2, start.spring.io/104.17.46.2] failed: Connection timed out: connect)

I find the fix by change the line of spring.bat, use quote to surrender %JAVA_OPTS%. Now it works

"%JAVA_EXE%" %JAVA_OPTS% -cp "%CLASSPATH%" org.springframework.boot.loader.JarLauncher %CMD_LINE_ARGS%

to

"%JAVA_EXE%" "%JAVA_OPTS%" -cp "%CLASSPATH%" org.springframework.boot.loader.JarLauncher %CMD_LINE_ARGS%

The linux cli has no such issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: supersededAn issue that has been superseded by another

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions