【发布时间】:2021-02-09 11:06:56
【问题描述】:
当试图通过 gradle 将 spring-boot-starter-data-jpa 添加到我的项目中时,它只是不这样做。 @Entity 标记不起作用,并且 jar 不会出现在项目和外部依赖项文件夹中。除非我输入 @Entity 标签,否则没有错误。这是我的 gradle 文件供参考。
plugins {
id 'org.springframework.boot' version '2.3.4.RELEASE'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'java'
}
group = 'com.Hype'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '14'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version:
'2.3.4.RELEASE'
implementation 'org.springframework.boot:spring-boot-starter-data-rest'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-web-services'
implementation 'org.springframework.session:spring-session-jdbc'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'mysql:mysql-connector-java'
annotationProcessor 'org.projectlombok:lombok'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testImplementation 'org.springframework.security:spring-security-test'
}
test {
useJUnitPlatform()
}
在任何人提及之前,是的,我已经多次尝试清理和重建项目。
【问题讨论】:
-
请将您的答案“SOLVED”添加为答案而不是编辑问题,然后将其从问题中删除并将此评论标记为不再需要。
标签: java spring spring-boot spring-boot-gradle-plugin