gradle: передача System properties в запускаемый процесс
(cherry picked from commit e7516edc57)
This commit is contained in:
16
build.gradle
16
build.gradle
@@ -139,9 +139,6 @@ subprojects {
|
||||
* -DworkDir=path\to\workdir
|
||||
* Если используется отдельная папка для имплементации логгера, то указываем
|
||||
* -DlogImplDir=path\to\logimpldir
|
||||
* Если необходимо передать дополнительные JVM параметры серверу, то указываем их с двойной "D", например:
|
||||
* -DDspringConfig=spring.xml
|
||||
* -DDlog4j.configurationFile=log4j2.xml
|
||||
*/
|
||||
task runServer(type: JavaExec) {
|
||||
main = 'mc.core.Main'
|
||||
@@ -153,14 +150,19 @@ task runServer(type: JavaExec) {
|
||||
}
|
||||
|
||||
if (System.getProperty("logImplDir") != null) {
|
||||
classpath += files(fileTree(dir: new File(System.getProperty("logImplDir"))))
|
||||
def logImplDir = new File(System.getProperty("logImplDir"))
|
||||
|
||||
if (logImplDir.isAbsolute()) {
|
||||
classpath += files(fileTree(dir: logImplDir))
|
||||
} else {
|
||||
classpath += files(fileTree(dir: new File(workingDir, logImplDir.getPath())))
|
||||
}
|
||||
} else {
|
||||
classpath += files(fileTree(dir: new File(workingDir, "log-impl")))
|
||||
}
|
||||
|
||||
System.getProperties().stringPropertyNames().stream()
|
||||
.filter{propName -> propName.startsWith("D")}
|
||||
.forEach{propName -> jvmArgs += "-D" + propName.substring(1) + "=" + System.getProperty(propName)}
|
||||
systemProperties System.properties
|
||||
systemProperties.put("user.dir", workingDir)
|
||||
|
||||
ignoreExitValue = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user