sourceCompatibility = 1.8
repositories { mavenCentral() }
apply plugin: 'org.junit.platform.gradle.plugin'
dependencies {
testCompile 'junit:junit:4.12'
compile 'junit:junit:4.12'
testRuntime("org.junit.vintage:junit-vintage-engine:4.12.0-M4")
testCompile("org.junit.jupiter:junit-jupiter-api:5.0.0-M4")
testRuntime("org.junit.jupiter:junit-jupiter-engine:5.0.0-M4")
// Enable use of the JUnitPlatform Runner within the IDE
testCompile("org.junit.platform:junit-platform-runner:1.0.0-M4")
compile ("org.junit.jupiter:junit-jupiter-api:5.0.0-M4")
}
sourceSets {
main {
java {
srcDir 'src'
}
}
}
junitPlatform {
details 'tree'
}
< /code>
Проблема здесь заключается в том, что аннотации JUNIT4 разрешаются импортом, но все аннотации V5 не решаются. < /p>
Один пример: < /p>
< /p>
@ParameterizedTest
public void testExample() {
// My annotations is not resolved
}
< /code>
Как правильно добавить зависимость junit5 с использованием Gradle?group 'com.iay0361'
version '1.0-SNAPSHOT'
apply plugin: 'java'
sourceCompatibility = 1.8
repositories { mavenCentral() }
apply plugin: 'org.junit.platform.gradle.plugin'
dependencies {
testCompile group: 'org.junit.vintage', name: 'junit-vintage-engine', version: '4.12.0-RC3'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.0.0-RC3'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.0.0-RC3'
compile group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.0.0-RC3'
testCompile group: 'org.junit.platform', name: 'junit-platform-runner', version: '1.0.0-RC3'
}
sourceSets {
main {
java {
srcDir 'src'
}
}
}
junitPlatform {
details 'tree'
}
< /code>
Я написал аннотацию @Test в тестируемом файле класса, после чего он попросил меня «добавить« junit5 »в classpath < /p>

< /p>
Файл все еще остается RC2, но в Build.Gradle это RC3.
В каталоге «Внешняя библиотека» нет банок «Внешняя библиотека» < /p>
.>
Подробнее здесь: https://stackoverflow.com/questions/461 ... ith-gradle