Help us understand the problem. What is going on with this article?

gradle wrapper でバージョン指定せずに最新バージョンにする

More than 1 year has passed since last update.

基本は Gradle のバージョンは wrapper で固定しておきます。変更する場合は https://services.gradle.org/distributions/ でバージョンを確認して、gradleVersion や gradle-wrapper.properties を手で書き換えて。。。 いやいや、そうぢゃなくて、俺は常に最新版にしときたいんだ! っていう人向け。

build.gradle
import groovy.json.JsonSlurper

wrapper {
    doFirst {
        def versionService = new URL('https://services.gradle.org/versions/current')
        gradleVersion = new JsonSlurper().parseText(versionService.text).version
        print("gradleVersion: " + gradleVersion)
    }
}
実行
gradlew wrapper

ちょっとゴリゴリですが、これでバージョン指定せずに Gradle wrapper を最新に更新でき、更新後のバージョンは gradle/wrapper/gradle-wrapper.properties で確認することができます。IntelliJ などで bin.zip ではなく、all.zip が必要な場合は、distributionType = Wrapper.DistributionType.ALL を指定します。

wrapper タスクすら実行したくないっていう人は dependsOn とかで。

cypher256
Pleiades 作ってます。 https://pleiades.io/
http://mergedoc.osdn.jp/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした