我知道Why are my Gradle builds dying with exit-code 137?,但这涉及测试目标吗?就我而言,我的单元测试通过了,但是IntegrationTest目标失败,退出代码为137。
$ ./gradlew --version
Welcome to Gradle 4.7!
Here are the highlights of this release:
- Incremental annotation processing
- JDK 10 support
- Grouped non-interactive console logs
- Failed tests are re-run first for quicker feedback
For more details see https://docs.gradle.org/4.7/release-notes.html
------------------------------------------------------------
Gradle 4.7
------------------------------------------------------------
Build time: 2018-04-18 09:09:12 UTC
Revision: b9a962bf70638332300e7f810689cb2febbd4a6c
Groovy: 2.4.12
Ant: Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM: 1.8.0_191 (Oracle Corporation 25.191-b12)
OS: Linux 4.14.94-89.73.amzn2.x86_64 amd64
$ ./gradlew :project:integrationTest
...
> Process 'Gradle Test Executor 1' finished with non-zero exit value 137
我具有以下JvmArgs设置,但是它们看不到会影响IntegrationTest目标,仅影响测试目标?
apply plugin: 'java'
test {
failFast = true
maxParallelForks = 2
maxHeapSize = '2g'
forkEvery = 100 // helps when tests leak memory
jvmArgs '-Xss1m', '-Xms128m', '-Xmx2g',
'-XX:+UnlockExperimentalVMOptions',
'-XX:+UseCGroupMemoryLimitForHeap',
'-XX:+PrintGCDetails',
'-XX:+PrintGCDateStamps',
'-XX:+PrintTenuringDistribution',
'-XX:+PrintGCCause',
'-XX:+UseGCLogFileRotation',
'-XX:NumberOfGCLogFiles=10',
'-XX:GCLogFileSize=5M',
'-Xloggc:/tmp/fs_oom.log',
'-XX:+HeapDumpOnOutOfMemoryError',
'-XX:HeapDumpPath=/tmp/fs_oom_err_pid<pid>.hprof',
'-XX:+UseGCOverheadLimit',
'-XX:OnError=cat /tmp/fs_oom.log',
'-XX:OnOutOfMemoryError=cat /tmp/fs_oom_err_pid<pid>.hprof'
}
integrationTest.failFast = test.failFast
integrationTest.maxParallelForks = test.maxParallelForks
integrationTest.maxHeapSize = test.maxHeapSize
integrationTest.forkEvery = test.forkEvery
integrationTest.jvmArgs = test.jvmArgs
该如何解决?
答案 0 :(得分:0)
在没有看到build.gradle
配置的情况下,很难说出您需要更改的内容。我假设您的integrationTest
任务是Test
类型的(类似于默认的test
任务)?您的配置中是否包含以下内容?
test {
…
jvmArgs '-Xss1m', '-Xms128m', '-Xmx2g', …
…
}
如果您尚未类似地配置integrationTest
任务,则应该能够从测试任务中复制JVM args配置,如下所示:
test {
…
jvmArgs '-Xss1m', '-Xms128m', '-Xmx2g', …
…
}
integrationTest.jvmArgs = test.jvmArgs