Kev*_*ing 5 java mysql spring gradle spring-boot
我按照https://spring.io/guides/gs/accessing-data-mysql/上的指南开始使用 MySQL for Gradle 项目,但是,当我尝试添加 @Entity 注释时
这是我的 build.gradle,它遵循网站上的相同内容:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.5.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
bootJar {
baseName = 'gs-accessing-data-mysql'
version = '0.1.0'
}
repositories {
mavenCentral()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
// JPA Data (We are going to use Repositories, Entities, Hibernate, etc...)
compile 'org.springframework.boot:spring-boot-starter-data-jpa'
compile group: 'javax.persistence', name: 'persistence-api', version: '1.0'
// Use MySQL Connector-J
compile 'mysql:mysql-connector-java'
testCompile('org.springframework.boot:spring-boot-starter-test')
}
Run Code Online (Sandbox Code Playgroud)
正如您在 SpringBoot 的依赖树中看到的,javax.persistence已经包含在 中spring-boot-starter-data-jpa,但它不是1.0.
消除:
compile group: 'javax.persistence', name: 'persistence-api', version: '1.0'
| 归档时间: |
|
| 查看次数: |
16447 次 |
| 最近记录: |