я делаю gradle clean build
у меня есть java класс
@SpringBootTest
class DemoApplicationTests {
@Test
void contextLoads() {
}
}
ошибка : не удается найти символ @ Test ^ символ: класс Место тестирования: class DemoApplicationTests В этой сборке использовались устаревшие функции Gradle , что делало его несовместимым с Gradle 7.0.
build.gradle
buildscript {
ext {
springBootVersion = '2.2.2.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
Просто скачал стартовый набор basi c springboot - но не скомпилируется, сама сборка maven потребовала некоторых усилий
Обновление
Исправлен файл gradle с правильной группой com.example
(смешанная смесь). Теперь ошибка изменилась:
one or more dependencies that were declared without a version failed to resolve:
org.springframework.boot:spring-boot-starter-web:
Did you forget to apply the io.spring.dependency-management plugin to the demo project?
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
> Could not find org.springframework.boot:spring-boot-starter-web:.
Required by:
project :
Также добавлено это, но все та же ошибка:
plugins {
id 'org.springframework.boot' version '2.2.2.RELEASE'
}
Thx