How can I dynamically change a plugin's version depending on certain criteria?
We have a multi platform project, however each platform has its own platform-dependent implementation of some classes. In our case, 2 of these target platforms require the same plugin, however they rely on different versions.
So far, I have tried to dynamically set
extra[pluginVersion]
via either -PbuildingForB
and gradle.taskGraph.whenReady
, then setting a classpath in the dependencies block of the buildscript block, and finally applying the plugin after the plugins block. Unfortunately, this errors with Cannot get property 'pluginVersion' on extra properties extension as it does not exist
.
4 Replies
⌛
This post has been reserved for your question.
Hey @cire! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
Why are you using
extra
as opposed to just defining a variable?Well I tried using a variable, the same issue occurred and I thought it might be some weird scoping issue, so i tried extra
using this
errors with
Unresolved reference: pluginVersion
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.