This is a problem I noticed in Spring Boot Gradle plugin when calling bootRun task from command line. In my build.gradle I have configured the task to use System.properties as properties:
configure(bootRun) {
systemProperties System.properties
}
The task fails to run with an exception that it did not find the main class "Corporation", which is not the main class of my project at all. With gradle --debug flag I could see that the generated command line to run the Spring-Boot application took all the system properties and set them with -D parameters, but not in quotes, which causes the command line to fail roughly at
[...] -Djava.specification.vendor=Oracle Corporation -Djava.specification.version=10 [...]
^
Expected Behavior
Strings with spaces are properly escaped to the needs of the terminal
Current Behavior
Strings are printed into the command line regardless of content.
Context
the aim is to forward -D[property]=[value] parameters from the CLI call into spring bootRun task but also generally into all Java executions of my builds
Steps to Reproduce (for bugs)
- Check your system properties if there are any properties with spaces, add one if necessary to the environment. Tested only under Windows.
- Set up a gradle project with the
org.springframework.boot extension, add the scriptlet above to its build.gradle, add whatever is needed to pass javaCompile phase and
- execute
gradle bootRun.
Your Environment
Windows 10 64bit
Oracle JDK 10.0.2
Gradle 4.9
plugins {
id 'org.springframework.boot' version '2.0.3.RELEASE'
id "com.energizedwork.webdriver-binaries" version "1.4"
}
This is a problem I noticed in Spring Boot Gradle plugin when calling bootRun task from command line. In my build.gradle I have configured the task to use System.properties as properties:
The task fails to run with an exception that it did not find the main class "Corporation", which is not the main class of my project at all. With gradle --debug flag I could see that the generated command line to run the Spring-Boot application took all the system properties and set them with -
Dparameters, but not in quotes, which causes the command line to fail roughly atExpected Behavior
Strings with spaces are properly escaped to the needs of the terminal
Current Behavior
Strings are printed into the command line regardless of content.
Context
the aim is to forward -D[property]=[value] parameters from the CLI call into spring bootRun task but also generally into all Java executions of my builds
Steps to Reproduce (for bugs)
org.springframework.bootextension, add the scriptlet above to its build.gradle, add whatever is needed to pass javaCompile phase andgradle bootRun.Your Environment
Windows 10 64bit
Oracle JDK 10.0.2
Gradle 4.9