最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - Junit tests (debug mode) not running on wsl - Stack Overflow

programmeradmin0浏览0评论

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.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 .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 
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

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..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 .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.
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

Share Improve this question asked Feb 3 at 21:09 Luigi CleffiLuigi Cleffi 94 bronze badges 2
  • Please add your code – Starship Commented Feb 4 at 13:12
  • The problem was not the code itself. In fact, any test run into that same problem if it was running into debug mode – Luigi Cleffi Commented Feb 4 at 13:59
Add a comment  | 

1 Answer 1

Reset to default 0

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.

发布评论

评论列表(0)

  1. 暂无评论