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