How to use property for version when using a plugin via id?

plugins

(Sebastian Schuberth) #1

In my gradle.properties I have

kotlinVersion=1.1.1

And in my build.gradle I have

plugins {
    id 'org.jetbrains.kotlin.jvm' version "${project.properties.kotlinVersion}"
 }

 println "${project.properties.kotlinVersion}"

But this yields

FAILURE: Build failed with an exception.

* Where:
Build file 'build.gradle' line: 2

* What went wrong:
Could not compile build file 'build.gradle'.
> startup failed:
  build file 'build.gradle': 2: argument list must be exactly 1 literal non empty string

  See https://docs.gradle.org/3.4.1/userguide/plugins.html#sec:plugins_block for information on the plugins {} block

   @ line 2, column 9.
             id 'org.jetbrains.kotlin.jvm' version "${project.properties.kotlinVersion}"
             ^

  1 error

Is there a particular reason why I cannot use properties to refer to the plugin version here?


(Dimitar Dimitrov) #2

This is a functional gap that the Gradle team has acknowledged and planning to address.

@st_oehme is there any update on the timeline, or any kind of roadmap document?


(Sebastian Schuberth) #3

Thanks Dimitar. If the Gradle team has already acknowledged this limitation, I assume there’s a tracking issue on GitHub you could provide a link for? So far I wasn’t able to find one.


(Stefan Oehme) #4

There is not, but please feel free to open one. Our plan is to fix this and many other shortcomings of the plugins DSL by the middle of this year.


(Sebastian Schuberth) #5

Done: https://github.com/gradle/gradle/issues/1697.