Issue
I'm having a problem with a gradle build.
Here is my build.gradle file :
import groovy.xml.XmlSlurper
import groovy.xml.MarkupBuilder
def property(String key) { return project.findProperty(key).toString() }
static def definedInPluginXml(String key) {
File pluginXmlFile = new File('src/main/resources/META-INF/plugin.xml')
def idea = new XmlSlurper().parse(pluginXmlFile)
return idea."$key"
}
plugins {
id 'org.jetbrains.intellij' version '1.5.3'
id 'groovy'
id 'java'
id 'org.jetbrains.changelog' version '1.2.1'
}
apply plugin: 'org.jetbrains.changelog'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.codehaus.groovy:groovy-all:3.0.9'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
}
// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
version = '2022.1'
plugins = ['java', 'com.intellij.java', 'org.intellij.groovy']
}
/**
* Refreshes the plugin.xml file for deployment
*/
String ideaMinVersion = property("ideaMinVersion")
String ideaMaxVersion = property("ideaMaxVersion")
String pluginVersion = property("version")
patchPluginXml {
changeNotes = changelog.get(pluginVersion).toHTML()
version = pluginVersion
sinceBuild = ideaMinVersion
untilBuild = ideaMaxVersion
}
test {
useJUnit()
filter{
includeTestsMatching "fr.nereide.*"
}
}
tasks {
runIde {
jvmArgs("-Xmx2048m")
}
}
/**
* Config for changelog Plugin
*/
changelog {
itemPrefix = "-"
keepUnreleasedSection = false
unreleasedTerm = "[Unreleased]"
groups = ["Added", "Changed", "Deprecated", "Removed", "Fixed", "Security"]
}
/**
* Generates the updatePlugin.xml files used for the repo.
*/
task generateUpdatePluginXml {
//...
}
/**
* Adds tests on build
*/
buildPlugin {
dependsOn 'test'
dependsOn 'generateUpdatePluginXml'
tasks.findByName('generateUpdatePluginXml').mustRunAfter 'patchPluginXml'
}
And here are the version infos :
./gradlew --version
Welcome to Gradle 7.1!
Here are the highlights of this release:
- Faster incremental Java compilation
- Easier source set configuration in the Kotlin DSL
For more details see https://docs.gradle.org/7.1/release-notes.html
------------------------------------------------------------
Gradle 7.1
------------------------------------------------------------
Build time: 2021-06-14 14:47:26 UTC
Revision: 989ccc9952b140ee6ab88870e8a12f1b2998369e
Kotlin: 1.4.31
Groovy: 3.0.7
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 11.0.15 (Oracle Corporation 11.0.15+3)
OS: Linux 5.15.32-1-MANJARO amd64
I updated the following dependencies :
- org.jetbrains.intellij from 1.1.4 to 1.5.3
- org.codehaus.groovy:groovy-all: from 2.5.14 to 3.0.9
Also updated
intellij { version = '2022.1' } // from 2021.2
Before the updates, the tests were found just fine. Now, after the updates, i get the following error :
Task :test FAILED Execution failed for task ':test'. No tests found for given includes: fr.nereide.*
And i'm kind of a gradle noob, it's very unclear to me how it works, i find the docs superficial.
So here are my questions :
- Is there a simple way to launch all tests (without any restrictions)
- Do i have to add the
@Test
decorator ? It wasn't necessary before updates, and doesn't change much with curent versions. - Where could i find the docs and informations i could have used to find the migrations infos on the packages i updated
- Is there some ressource like Gradle for Dummies that someone could actually recommend ?
Thanks in advance !
Solution
Found the issue, it's been a while i know.
i replaced useJUnit()
with useJUnitPlatform()
and
dependencies {
implementation 'org.codehaus.groovy:groovy-all:3.0.9'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
}
with
dependencies {
implementation 'org.codehaus.groovy:groovy-all:3.0.9'
testImplementation platform('org.junit:junit-bom:5.8.2')
testImplementation 'org.junit.jupiter:junit-jupiter'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
}
Answered By - Gaetan
Answer Checked By - Katrina (JavaFixing Volunteer)