Original answer (using Gradle 1.12 and Spring Boot 1.0.x):
The Spring Boot Gradle plugin bootRun task extends the JavaExec Gradle task. Cm. .
This means that you can configure the plugin to use a proxy by adding:
bootRun { jvmArgs = "-Dhttp.proxyHost=xxxxxx", "-Dhttp.proxyPort=xxxxxx" }
into the assembly file.
Of course you can use systemProperties instead of jvmArgs
If you want to conditionally add jvmArgs from the command line, you can do the following:
bootRun { if ( project.hasProperty('jvmArgs') ) { jvmArgs project.jvmArgs.split('\\s+') } } gradle bootRun -PjvmArgs="-Dwhatever1=value1 -Dwhatever2=value2"
Updated answer:
After polling my solution above using Spring Boot 1.2.6.RELEASE and Gradle 2.7, I noticed that it does not work, as some of the comments say. However, some minor changes can be made to restore operation.
New code:
bootRun { jvmArgs = ["-Dhttp.proxyHost=xxxxxx", "-Dhttp.proxyPort=xxxxxx"] }
for hardcoded arguments and
bootRun { if ( project.hasProperty('jvmArgs') ) { jvmArgs = (project.jvmArgs.split("\\s+") as List) } }
for command line arguments
geoand Aug 01 '14 at 11:39 on 2014-08-01 11:39
source share