我一直在从事 Spring Boot 项目(版本 2.0.4.RELEASE)。以下是 build.gradle
plugins {
id 'java'
id 'eclipse'
id 'org.springframework.boot' version '2.0.4.RELEASE'
id 'io.spring.dependency-management' version '1.0.6.RELEASE'
}
sourceCompatibility = 1.8
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
runtimeOnly 'com.h2database:h2'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
repositories {
jcenter()
}
我通过在 Gradle 中使用 eclipse 插件创建 eclipse 配置文件将项目导入到 eclipse 中。
我使用javax.inject.Inject
注释而无需添加额外的依赖项,并使用 eclipse 运行应用程序而没有任何问题。
但是,当我最近在命令行上进行了干净的构建时,构建失败了,因为它找不到@Inject
error: cannot find symbol
@Inject
^
这可能是什么原因?