Luigi Cleffi
Luigi Cleffi

Reputation: 9

Junit tests (debug mode) not running on wsl

Lately I've been struggling to run tests on debug for an application that uses Gradle.

[info]

WSL Version: 24.04 LTS
Win 11
IntelliJ Ultimate

Error:

Starting Gradle Daemon...
Gradle Daemon started in 918 ms
Errors occurred while building effective model from /home/luigi/.gradle/caches/modules-2/files-2.1/log4j/log4j/1.2.16/88efb1b8d3d993fe339e9e2b201c75eed57d4c65/log4j-1.2.16.pom:
    'build.plugins.plugin[io.spring.gradle.dependencymanagement.org.apache.maven.plugins:maven-antrun-plugin].dependencies.dependency.scope' for junit:junit:jar must be one of [compile, runtime, system] but is 'test'. in log4j:log4j:1.2.16
> Task :generateGrammarSource UP-TO-DATE
> Task :generateJava UP-TO-DATE
> Task :compileJava UP-TO-DATE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :generateTestGrammarSource NO-SOURCE
> Task :compileTestJava UP-TO-DATE
> Task :processTestResources UP-TO-DATE
> Task :testClasses UP-TO-DATE
> Task :test FAILED
FAILURE: Build failed with an exception.
* Where:
Initialization script '/tmp/ijJvmDebugger1.gradle' line: 19
* What went wrong:
Execution failed for task ':test'.
> 'void org.gradle.api.tasks.testing.Test.setForkEvery(long)'
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 10s
7 actionable tasks: 1 executed, 6 up-to-date

.wslconfig

[wsl2] 
networkingMode=mirrored
[experimental]
autoMemoryReclaim=gradual

So far I have removed temp files and "run gradle clean".

I was expecting that the tests should run just like it runs without debug

Upvotes: -1

Views: 41

Answers (1)

Arthur
Arthur

Reputation: 1

The cause of this error seems not to be a wsl problem but instead a bug with the log4j lib version that you are using. You have the same error that is mentioned in this github post Upgrade your log4j version from 1.2.16 -> 1.2.17 should fix your problem.

Upvotes: 0

Related Questions