なにか作る

なにかを作るブログです。

Gradle で依存ライブラリの新しいバージョンが出てないかを一括チェックする

ブログ久しく書いていなかった。リハビリ的に簡単な記事を一つ。

依存ライブラリが多くなりがち、かつ頻繁なアップデートがありがちな昨今、ライブラリのバージョンアップに追随するために常にバージョン情報を監視しておく必要があったりする。

Gradle で良さげなプラグインを見つけた。

GitHub - ben-manes/gradle-versions-plugin: Gradle plugin to discover dependency updates

使い方は簡単。README.md に書いてあるとおりだ。

まずは、build.gradle にプラグイン定義を記入し、

plugins {
    id 'com.github.ben-manes.versions' version '0.14.0'
}

あとは追加された dependencyUpdates タスクを実行するだけ。

------------------------------------------------------------
: Project Dependency Updates (report to plain text file)
------------------------------------------------------------

The following dependencies are using the latest milestone version:
 - com.github.ben-manes:gradle-versions-plugin:0.14.0

The following dependencies have later milestone versions:
 - com.h2database:h2 [1.4.193 -> 1.4.195]
 - org.projectlombok:lombok [1.16.14 -> 1.16.16]
 - or
 - org.springframework.boot:spring-boot-devtools [1.5.2.RELEASE -> 1.5.3.RELEASE]
 - org.springframework.boot:spring-boot-gradle-plugin [1.5.2.RELEASE -> 1.5.3.RELEASE]
 - org.springframework.boot:spring-boot-starter-actuator [1.5.2.RELEASE -> 1.5.3.RELEASE]
 - org.springframework.boot:spring-boot-starter-data-jpa [1.5.2.RELEASE -> 1.5.3.RELEASE]
 - or
 - org.springframework.boot:spring-boot-starter-data-rest [1.5.2.RELEASE -> 1.5.3.RELEASE]
 - org.springframework.boot:spring-boot-starter-test [1.5.2.RELEASE -> 1.5.3.RELEASE]
 - org.springframework.data:spring-data-rest-hal-browser [2.6.1.RELEASE -> 2.6.3.RELEASE]

Failed to determine the latest version for the following dependencies (use --info for details):
 - gr
 - gradle.plugin.com.palantir.gradle.docker:gradle-docker

Generated report file build/dependencyUpdates/report.txt

BUILD SUCCESSFUL

便利。JSON 形式や XML 形式でも出力できるようなので、色々と使い道はありそう。