如何使用Gradle with Spring Boot获取Gosling Release Train of Spring数据?

Ken*_*son 5 spring gradle spring-data spring-boot

如何将最新的Gosling版本系列列入我的Gradle构建文件?

我曾经在大多数依赖项中使用1.1.9.RELEASE组.现在我需要修复这里RepositoryRestMvcConfiguration提到的问题并且这样做我正在尝试升级到spring Data的最新版本,它根据我链接的github问题修复了bug.

当我添加Gosling版本系列依赖项时,我还删除了spring-data-jpa的spring启动程序和spring-data-rest,认为我可能存在依赖冲突.这样做会拉入新的jar文件,但现在我的cannot find symbol所有javax.persistence注释都出错了.

我可以使用带有弹簧启动启动器的Gosling版本系列,还是我必须弄清楚如何手动拉入所有弹簧启动依赖关系才能使用Gosling?

我在Mac OS X Yosemite上使用Gradle 2.3.10.

新规范

buildscript {
  ext {
    springBootVersion = '1.3.0.M3'
  }
  repositories {
    jcenter()
    mavenCentral()
    //maven { url "https://repo.spring.io/snapshot" }
    maven { url "https://repo.spring.io/milestone" }
  }
  dependencies {
    classpath "io.spring.gradle:dependency-management-plugin:0.5.0.RELEASE"
    classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
  }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: "io.spring.dependency-management"

ext {
  springVersion = '4.1.6.RELEASE'
  springDataVersion = 'Gosling-RELEASE'
}

dependencyManagement {
  imports {
    mavenBom "org.springframework:spring-framework-bom:${springVersion}"
    mavenBom "org.springframework.data:spring-data-releasetrain:${springDataVersion}"
  }
}

jar {
  baseName = 'my-data-api'
  version = '0.0.1'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
  jcenter()
  mavenCentral()
  //maven { url "https://repo.spring.io/snapshot" }
  maven { url "https://repo.spring.io/milestone" }
}

dependencies {
  compile("org.springframework.boot:spring-boot-starter-actuator:1.3.0.M3")
  compile("org.springframework.boot:spring-boot-starter-aop:1.3.0.M3")
  compile 'org.springframework.data:spring-data-jpa'
  compile 'org.springframework.data:spring-data-rest-webmvc'
  compile("org.springframework.boot:spring-boot-starter-web:1.3.0.M3")
  compile("org.springframework.boot:spring-boot-starter-jdbc:1.3.0.M3")
  compile('org.antlr:stringtemplate:4.0.2')
  compile('org.apache.commons:commons-lang3:3.0')
  compile('commons-io:commons-io:2.4')
  compile('com.ingres.jdbc:iijdbc:10.0-4.0.5')

  testCompile("org.springframework.boot:spring-boot-starter-test:1.3.0.M3")
}
Run Code Online (Sandbox Code Playgroud)

旧代码

buildscript {
ext {
    springBootVersion = '1.3.0.M2'
}
repositories {
    jcenter()
    mavenCentral()
    maven { url "https://repo.spring.io/snapshot" }
    maven { url "https://repo.spring.io/milestone" }
}
dependencies {
    classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 
}
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'

jar {
  baseName = 'my-data-api'

  version = '0.0.1'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
  jcenter()
  mavenCentral()
  maven { url "https://repo.spring.io/snapshot" }
  maven { url "https://repo.spring.io/milestone" }
}

dependencies {
  compile("org.springframework.boot:spring-boot-starter-actuator:1.2.0.RC2")
  compile("org.springframework.boot:spring-boot-starter-aop:1.1.9.RELEASE")
  compile("org.springframework.boot:spring-boot-starter-data-jpa:1.1.9.RELEASE")
  compile("org.springframework.boot:spring-boot-starter-web:1.1.9.RELEASE")
  compile("org.springframework.boot:spring-boot-starter-data-rest:1.1.9.RELEASE")
  compile("org.springframework.boot:spring-boot-starter-jdbc:1.1.9.RELEASE")
  compile('org.antlr:stringtemplate:4.0.2')
  compile('org.apache.commons:commons-lang3:3.0')
  compile('commons-io:commons-io:2.4')

  compile('com.ingres.jdbc:iijdbc:10.0-4.0.5')

  testCompile("org.springframework.boot:spring-boot-starter-test:1.1.9.RELEASE")
}
Run Code Online (Sandbox Code Playgroud)

编辑:

如果我在build.gradle中放置一个javax持久性依赖项,那么我可以成功构建并使用RepositoryRestConfigurerAdapter,但是我的entityManagerFactory缺少依赖项的运行时问题

Ily*_*sev 4

如果您已经在使用 Spring Boot 的里程碑版本,我建议您切换到 M5。它包括 Gosling-RELEASE Spring Data。