Skip to content
This repository has been archived by the owner on Aug 19, 2020. It is now read-only.

Gradle wrapper configuration #956

Closed
deeprim opened this issue Jul 9, 2018 · 4 comments
Closed

Gradle wrapper configuration #956

deeprim opened this issue Jul 9, 2018 · 4 comments

Comments

@deeprim
Copy link

deeprim commented Jul 9, 2018

Gradle Wrapper Configuration

Expected Behavior

Ability to configure default gradle wrapper via kotlin DSL

Current Behavior

task<Wrapper>("wrapper") { /**...*/ }

above code spawns warning:
Creating a custom task named 'wrapper' has been deprecated and is scheduled to be removed in Gradle 5.0. You can configure the existing task using the 'wrapper { }' syntax or create your custom task under a different name.'.

wrapper { } 

above doesn't compile with following errors:
Line 45: wrapper {
^ Expression 'wrapper' cannot be invoked as a function. The function 'invoke()' is not found

Line 45: wrapper {
^ Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public val PluginDependenciesSpec.wrapper: PluginDependencySpec defined in org.gradle.kotlin.dsl

wrapper task with different name (e.g. gradleWrapper) doesn't work well with IntelliJ IDEA. IDEA doesn't not use it to configure the wrapper

Your Environment

Gradle 4.8.1

@mkobit
Copy link
Contributor

mkobit commented Jul 9, 2018

Accessors aren't generated for tasks, so just doing wrapper {} will fail to compile. The accessors for tasks may be done in #879

To configure an existing task with type do something like the following:

tasks {
  "wrapper"(Wrapper::class) {
    // configuration here
  }
}

@JLLeitschuh
Copy link
Contributor

This should be documented here:
https://docs.gradle.org/current/userguide/gradle_wrapper.html

@tadfisher
Copy link

tasks.withType<Wrapper> {
    gradleVersion = "4.9"
    // anything else
}

@eskatos
Copy link
Member

eskatos commented Aug 1, 2018

Superseded by gradle/gradle#5923

@eskatos eskatos closed this as completed Aug 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants