C3rd
Gradle Project Tests
Posted: 6 Jun 2020, 9:59am - Saturday
The Error:
gradle Caused by: org.junit.platform.commons.PreconditionViolationException: Cannot create Launcher without at least one TestEngine; consider adding an engine implementation JAR to the classpath
I've been writing tests on my java gradle project and I thought the tests was running every time I compile. I'm using IntelliJ IDEA and when I right click the test folder and `Run All Tests`, seems to work well.
Then I found out that it wasn't running at all when I ran the report.

"Five hours later..." I almost gave up and decided to go back to maven. Then thought maybe I will search the error one last time. Landed to this page: https://discuss.gradle.org/t/gradle-4-6-and-junit-5/26061 -- then decided to give one last try. So I change my build.gradle
plugins {
id 'java'
id 'project-report'
}
group 'nz.camilord.alphaone.sample'
version '1.0.0-SNAPSHOT'
sourceCompatibility = 11
targetCompatibility = 11
repositories {
mavenCentral()
}
dependencies {
compile 'postgresql:postgresql:9.0-801.jdbc4'
compile 'com.google.code.gson:gson:2.8.0'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.6.2'
//testCompile 'junit:junit:4.13'
}
to this new configuration:
plugins {
id 'java'
id 'project-report'
}
group 'nz.camilord.alphaone.sample'
version '1.0.0-SNAPSHOT'
sourceCompatibility = 11
targetCompatibility = 11
repositories {
mavenCentral()
}
dependencies {
compile 'postgresql:postgresql:9.0-801.jdbc4'
compile 'com.google.code.gson:gson:2.8.0'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.6.2'
testCompile 'org.jetbrains.spek:spek-junit-platform-engine:1.0.89'
testRuntime 'org.junit.jupiter:junit-jupiter-engine'
//testCompile 'junit:junit:4.13'
}
test {
useJUnitPlatform()
}
configurations {
externalLibraries
compile.extendsFrom (externalLibraries)
}
... and the result is a success! It works!

Search
Categories
Related Links
- Apache Web Server
- ASP Immigration Services Ltd.
- CentOS Linux
- Color Scheme Picker
- CSS Button Generator
- Deviant Art Account
- Don Tabaniag - GraphiCult
- Jerson Maglasang Weblog
- Joshua Manlunas
- Mark "mungkey" Vicente
- Matt Arnilo Baluyos
- MySQL
- Paul Labis
- PHP
- PrendStar
- Ridvan Baluyos
- Scott Davies
- SEO Fart XML-RPC Ping Tool
- Stripes Generator
- The Hero
- Ubuntu Linux
- Vim Carlo Nabora (DA)
- Wella Maria Hong
- What is my IP?
- Xavier University - Ateneo de Cagayan
- Zabyer Community