Spring Boot 1.4.x の Web アプリを 1.5.x へバージョンアップする ( その9 )( Spring Boot を 1.5.3 → 1.5.4 にバージョンアップする )
概要
- 今回の手順で確認できるのは以下の内容です。
- Spring Boot の 1.5.4 がリリースされているのでバージョンアップします。
- Error Prone 以外のライブラリも最新バージョンにバージョンアップします。
参照したサイト・書籍
目次
手順
build.gradle を変更する
build.gradle を リンク先の内容 に変更します。
変更後、Gradle Tool Window の左上にある「Refresh all Gradle projects」ボタンをクリックして更新します。
Spring Boot が 1.5.4.RELEASE にバージョンアップされていることを確認します。
clean タスク → Rebuild Project → build タスクを実行する
clean タスク → Rebuild Project → build タスクを実行します。
無事 “BUILD SUCCESSFUL” のメッセージが表示されています。
Project Tool Window の src/test から「Run ‘All Tests’ with Coverage」を実行すると、こちらも全てのテストが成功しました。
ソースコード
build.gradle
group 'ksbysample' version '1.5.4-RELEASE' buildscript { ext { springBootVersion = '1.5.4.RELEASE' } repositories { jcenter() maven { url "https://repo.spring.io/release/" } maven { url "https://plugins.gradle.org/m2/" } } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") // for Error Prone ( http://errorprone.info/ ) classpath("net.ltgt.gradle:gradle-errorprone-plugin:0.0.10") // for Grgit classpath("org.ajoberstar:grgit:1.9.3") // Gradle Download Task classpath("de.undercouch:gradle-download-task:3.2.0") } } apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: 'org.springframework.boot' apply plugin: 'de.undercouch.download' apply plugin: 'groovy' apply plugin: 'net.ltgt.errorprone' apply plugin: 'checkstyle' apply plugin: 'findbugs' sourceCompatibility = 1.8 targetCompatibility = 1.8 task wrapper(type: Wrapper) { gradleVersion = '3.5' } [compileJava, compileTestGroovy, compileTestJava]*.options*.compilerArgs = ['-Xlint:all,-options,-processing,-path'] compileJava.options.compilerArgs += ['-Xep:RemoveUnusedImports:WARN'] // for Doma 2 // JavaクラスとSQLファイルの出力先ディレクトリを同じにする processResources.destinationDir = compileJava.destinationDir // コンパイルより前にSQLファイルを出力先ディレクトリにコピーするために依存関係を逆転する compileJava.dependsOn processResources idea { module { inheritOutputDirs = false outputDir = file("$buildDir/classes/main/") } } configurations { // for Doma 2 domaGenRuntime } checkstyle { configFile = file("${rootProject.projectDir}/config/checkstyle/google_checks.xml") toolVersion = '7.8.1' sourceSets = [project.sourceSets.main] } findbugs { toolVersion = '3.0.1' sourceSets = [project.sourceSets.main] ignoreFailures = true effort = "max" excludeFilter = file("${rootProject.projectDir}/config/findbugs/findbugs-exclude.xml") } tasks.withType(FindBugs) { // Gradle 3.3以降 + FindBugs Gradle Plugin を組み合わせると、"The following errors occurred during analysis:" // の後に "Cannot open codebase filesystem:..." というメッセージが大量に出力されるので、以下の doFirst { ... } // のコードを入れることで出力されないようにする doFirst { def fc = classes if (fc == null) { return } fc.exclude '**/*.properties' fc.exclude '**/*.xml' fc.exclude '**/META-INF/**' fc.exclude '**/static/**' fc.exclude '**/templates/**' classes = files(fc.files) } reports { xml.enabled = false html.enabled = true } } repositories { jcenter() } dependencyManagement { imports { // BOM は https://repo.spring.io/release/io/spring/platform/platform-bom/Brussels-SR3/ // の下を見ること mavenBom("io.spring.platform:platform-bom:Brussels-SR3") { bomProperty 'guava.version', '21.0' bomProperty 'thymeleaf.version', '3.0.6.RELEASE' bomProperty 'thymeleaf-extras-springsecurity4.version', '3.0.2.RELEASE' bomProperty 'thymeleaf-layout-dialect.version', '2.2.2' bomProperty 'thymeleaf-extras-data-attribute.version', '2.0.1' bomProperty 'thymeleaf-extras-java8time.version', '3.0.0.RELEASE' } } } bootRepackage { mainClass = 'ksbysample.webapp.lending.Application' } dependencies { def jdbcDriver = "org.postgresql:postgresql:42.1.1" def spockVersion = "1.1-groovy-2.4" def domaVersion = "2.16.1" def lombokVersion = "1.16.16" def errorproneVersion = "2.0.15" // dependency-management-plugin によりバージョン番号が自動で設定されるもの // Appendix A. Dependency versions ( http://docs.spring.io/platform/docs/current/reference/htmlsingle/#appendix-dependency-versions ) 参照 compile("org.springframework.boot:spring-boot-starter-web") compile("org.springframework.boot:spring-boot-starter-thymeleaf") compile("org.thymeleaf.extras:thymeleaf-extras-springsecurity4") compile("org.thymeleaf.extras:thymeleaf-extras-java8time") compile("org.springframework.boot:spring-boot-starter-data-jpa") compile("org.springframework.boot:spring-boot-starter-freemarker") compile("org.springframework.boot:spring-boot-starter-mail") compile("org.springframework.boot:spring-boot-starter-security") compile("org.springframework.boot:spring-boot-starter-data-redis") compile("org.springframework.boot:spring-boot-starter-amqp") compile("org.springframework.boot:spring-boot-devtools") compile("org.springframework.session:spring-session") compile("org.springframework.retry:spring-retry") compile("com.fasterxml.jackson.datatype:jackson-datatype-jsr310") compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml") compile("com.google.guava:guava") compile("org.apache.commons:commons-lang3") compile("org.codehaus.janino:janino") testCompile("org.springframework.boot:spring-boot-starter-test") testCompile("org.springframework.security:spring-security-test") testCompile("org.yaml:snakeyaml") testCompile("org.mockito:mockito-core") // dependency-management-plugin によりバージョン番号が自動で設定されないもの、あるいは最新バージョンを指定したいもの runtime("${jdbcDriver}") compile("com.integralblue:log4jdbc-spring-boot-starter:1.0.1") compile("org.simpleframework:simple-xml:2.7.1") compile("com.univocity:univocity-parsers:2.4.1") testCompile("org.dbunit:dbunit:2.5.3") testCompile("com.icegreen:greenmail:1.5.5") testCompile("org.assertj:assertj-core:3.8.0") testCompile("com.jayway.jsonpath:json-path:2.2.0") testCompile("org.jsoup:jsoup:1.10.3") testCompile("cglib:cglib-nodep:3.2.5") testCompile("org.spockframework:spock-core:${spockVersion}") { exclude module: "groovy-all" } testCompile("org.spockframework:spock-spring:${spockVersion}") { exclude module: "groovy-all" } testCompile("com.google.code.findbugs:jsr305:3.0.2") // for lombok compileOnly("org.projectlombok:lombok:${lombokVersion}") testCompileOnly("org.projectlombok:lombok:${lombokVersion}") // for Doma compile("org.seasar.doma:doma:${domaVersion}") domaGenRuntime("org.seasar.doma:doma-gen:${domaVersion}") domaGenRuntime("${jdbcDriver}") // for Error Prone ( http://errorprone.info/ ) errorprone("com.google.errorprone:error_prone_core:${errorproneVersion}") compileOnly("com.google.errorprone:error_prone_annotations:${errorproneVersion}") } ..........
version '1.5.3-RELEASE'
→version '1.5.4-RELEASE'
へ変更します。- buildscript の以下の点を変更します。
springBootVersion = '1.5.3.RELEASE'
→springBootVersion = '1.5.4.RELEASE'
へ変更します。maven { url "http://repo.spring.io/repo/" }
→maven { url "https://repo.spring.io/release/" }
へ変更します。classpath("org.ajoberstar:grgit:1.9.2")
→classpath("org.ajoberstar:grgit:1.9.3")
へ変更します。
- checkstyle の以下の点を変更します。
toolVersion = '7.7'
→toolVersion = '7.8.1'
へ変更します。
- dependencyManagement の以下の点を変更します。
mavenBom("io.spring.platform:platform-bom:Brussels-SR2")
→mavenBom("io.spring.platform:platform-bom:Brussels-SR3")
へ変更します。
- dependencies の以下の点を変更します。
def jdbcDriver = "org.postgresql:postgresql:42.0.0"
→def jdbcDriver = "org.postgresql:postgresql:42.1.1"
へ変更します。def domaVersion = "2.16.0"
→def domaVersion = "2.16.1"
へ変更します。testCompile("com.icegreen:greenmail:1.5.4")
→testCompile("com.icegreen:greenmail:1.5.5")
へ変更します。testCompile("org.assertj:assertj-core:3.7.0")
→testCompile("org.assertj:assertj-core:3.8.0")
へ変更します。testCompile("org.jsoup:jsoup:1.10.2")
→testCompile("org.jsoup:jsoup:1.10.3")
へ変更します。
履歴
2017/06/17
初版発行。