Ruokki
Ruokki

Reputation: 957

Enable junit extensions autodetection with gradle

I would like to enable by default junit extension autoDetection on my project if i understantd I should use -Djunit.jupiter.extensions.autodetection.enabled=true when i launch my build.

But i want to enable by default without extra parameters in the command line and in all my subModule.

I thing something like that should be good :

allprojects {
    test {
        //put an option here
        useJUnitPlatform()
    }

}

But i've no clue of which option to put in my build.gradle.

Upvotes: 2

Views: 1137

Answers (1)

johanneslink
johanneslink

Reputation: 5351

In Gradle you can use the system properties extension:

test {
    // ...
    systemProperty("junit.jupiter.extensions.autodetection.enabled", true)
}

See JUnit 5 User Guide for further details.

Upvotes: 3

Related Questions