该项目的gradle构建在不久前工作正常,但现在始终失败并出现以下错误(使用--info标志输出):
Starting process 'Gradle Test Executor 1'. Working directory: /home/abc/git/xyz Command: /usr/lib/jvm/java-8-oracle/bin/java -Djava.security.manager=jarjar.org.gradle.process.internal.child.BootstrapSecurityManager -DsysProp=value -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -ea -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005 -cp /home/abc/git/xyz/$PATH:/opt/abc/gradle-2.9/caches/2.9/workerMain/gradle-worker.jar jarjar.org.gradle.process.internal.launcher.GradleWorkerMain 'Gradle Test Executor 1'
Successfully started process 'Gradle Test Executor 1'
Error occurred during initialization of VM
java.lang.InternalError: Could not create SecurityManager: jarjar.org.gradle.process.internal.child.BootstrapSecurityManager
at sun.misc.Launcher.<init>(Launcher.java:106)
at sun.misc.Launcher.<clinit>(Launcher.java:57)
at java.lang.ClassLoader.initSystemClassLoader(ClassLoader.java:1448)
at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:1433)
Starting process 'Gradle Test Executor 2'. Working directory: /home/abc/git/xyz Command: /usr/lib/jvm/java-8-oracle/bin/java -Djava.security.manager=jarjar.org.gradle.process.internal.child.BootstrapSecurityManager -DsysProp=value -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -ea -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005 -cp /home/abc/git/xyz/$PATH:/opt/abc/gradle-2.9/caches/2.9/workerMain/gradle-worker.jar jarjar.org.gradle.process.internal.launcher.GradleWorkerMain 'Gradle Test Executor 2'
Successfully started process 'Gradle Test Executor 2'
Error occurred during initialization of VM
java.lang.InternalError: Could not create SecurityManager: jarjar.org.gradle.process.internal.child.BootstrapSecurityManager
at sun.misc.Launcher.<init>(Launcher.java:106)
at sun.misc.Launcher.<clinit>(Launcher.java:57)
at java.lang.ClassLoader.initSystemClassLoader(ClassLoader.java:1448)
at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:1433)
Process 'Gradle Test Executor 2' finished with non-zero exit value 1
org.gradle.process.internal.ExecException: Process 'Gradle Test Executor 2' finished with non-zero exit value 1
at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:367)
at org.gradle.process.internal.DefaultWorkerProcess.onProcessStop(DefaultWorkerProcess.java:91)
at org.gradle.process.internal.DefaultWorkerProcess.access$000(DefaultWorkerProcess.java:35)
at org.gradle.process.internal.DefaultWorkerProcess$1.executionFinished(DefaultWorkerProcess.java:57)
at sun.reflect.GeneratedMethodAccessor302.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44)
at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy50.executionFinished(Unknown Source)
at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:214)
at org.gradle.process.internal.DefaultExecHandle.finished(DefaultExecHandle.java:312)
at org.gradle.process.internal.ExecHandleRunner.completed(ExecHandleRunner.java:103)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:83)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
知道可能导致问题的原因以及如何最好地解决问题?
答案 0 :(得分:2)
对于其他可能遇到此问题的人,我通过以下方式解决了这个问题:
rm -rf ~/.gradle
rm -rf YOUR_PROJECT/.gradle
我首先尝试了rm -rf ~/.gradle/caches
,但这还不够。
答案 1 :(得分:1)
在运行任务之前尝试运行“ gradle --stop”
gradle --stop
答案 2 :(得分:1)
删除gradle缓存文件夹后,问题消失了。
删除.gradle/caches
文件夹并尝试。
答案 3 :(得分:1)
我遇到了类似的错误-
Error occurred during initialization of VM java.lang.InternalError: Could not create SecurityManager: worker.org.gradle.process.internal.worker.child.BootstrapSecurityManager at sun.misc.Launcher.<init>(Launcher.java:103)
this GitHub issue #4689 上提到的建议对我有帮助-
<HOME>/.gradle/caches
./gradlew --stop
./gradlew build
答案 4 :(得分:-1)
问题源于单元测试(飞行员错误)。当我使用跳过测试运行构建时,构建过程运行正常。显然,需要修复单元测试来解决这个问题(而不是使用跳过测试乐队助手)。