'Error opening zip file or JAR manifest missing : build/tmp/expandedArchives/org.jacoco.agent

Error while running test coverage using Jacoco.

I am currently using operating system Windows 10 Professional, Java 8, Gradle.

CLI to execute test coverage report I am using the command:

gradlew sonarqube -Dsonar.projectKey=projectKey -Dsonar.host.url=http://localhost:9000 -Dsonar.login=c231ced071c19ae0ab12342dfgd3fa17e85fd6a5

While I am running jacoco to publish report in local sonarqube, I am getting the following error:

Error occurred during initialization of VM

Error opening zip file or JAR manifest missing : build/tmp/expandedArchives/org.jacoco.agent-0.8.5.jar_6a2df60c47de373ea127d14406367999/jacocoagent.jar
agent library failed to init: instrument

Error occurred during initialization of VM

Error opening zip file or JAR manifest missing : build/tmp/expandedArchives/org.jacoco.agent-0.8.5.jar_6a2df60c47de373ea127d14406367999/jacocoagent.jar
agent library failed to init: instrument

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:417)
  at org.gradle.process.internal.worker.DefaultWorkerProcess.onProcessStop(DefaultWorkerProcess.java:141)

Please need your input to resolve this issue. Thanks in advance.



Solution 1:[1]

I had the same issue. I changed name of folders in file system to reduce the path to the project - it works for me.

Solution 2:[2]

Run the next command gradlew clean build -d, this takes a few seconds. Then run this command gradlew --stop.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Andry Max
Solution 2 lazarokcf