Hello everyone! I have a multi-project using Kotli...
# gradle
x
Hello everyone! I have a multi-project using Kotlin DSL: https://gist.github.com/x80486/52d5b8f1d584f90732e7d1881df423a7 I'm trying to understand why there are some tasks that are being applied still to the root project. There is nothing there, no
src
, etc. ...so I'm not expecting that Gradle executes anything on it, but on the modules within that umbrella project...any clues? In Maven that's correctly executed, so I think there should be an equivalent in Gradle...thanks in advance!
a
You need to specify
apply false
after declaring the plugins (such as kotlin) in the root project to skip actually applying them. It isn’t automatically done based on whether there appears to be any source there
and there’s no benefit in specifying a gradle built-in plugin with
apply false
, you can just take those out of the root
and you can typically just write them as symbols rather than as id strings (e.g. just
plugins { eclipse }
)
x
I didn't paste the latest one...but I do have the
apply false
to the Kotlin plugin (but just that one):
id("org.jetbrains.kotlin.jvm").version("1.3.72").apply(false)
...still, the same output
a
but you’re applying the base plugin to the root - which is where the assemble/check/build tasks come from
x
...and yeah, I get what you are saying on the other part: write the plugins as symbols, but I don't like that others must be declared in such way, so I put them all as
id(string)<.version(version)>
, but I get your point that I loose the type safety on it and such
Ah! I thought that the
base
plugin was a must for multi-projects 😱 ...clearly I'm not keen in Gradle
a
it’s usually applied automatically by plugins like Kotlin that will register dependencies against its tasks
👌 1
Also, the
application
plugin is for building distributions, you don’t want that in your root project either
x
Yeah, I moved that one too...and you were entirely right,
id("org.gradle.base")
was the one bringing those tasks to the "root" project...now it is in the way I intended to be...thank you so much, @araqnid!