Can't not install built-in plugins on root project if I want to use it in subprojects block in root project #916
Comments
This also has impact on static accessors for subprojects. Imagine, I want to have an
But I cannot do that:
Actualy no-op is what I want indeed! Without having |
I think that the problem with this is that in order to generate the accessors, the plugin is applied to the project before compiling in order to generate the accessors. In order for |
Using @FredDeschenes simply remove the core @madhead simply remove |
@eskatos, how do I get access function for dependency configuration ( |
@madhead if your root project doesn't have those configurations, then no accessors for them will be available in your root project build script. You need to reference them by name: subprojects {
dependencies {
"implementation"("some:dep:1.0")
}
} You can also bring a reference into scope if you prefer or need to reference the configurations several times: subprojects {
val implementation by configurations
dependencies {
implementation("some:dep:1.0")
}
} |
@eskatos, nice trick, thanks! However, it would be could to have the ability to just reference it, like it works for third-party plugins (when you |
@eskatos : Well I can't remove the application plugin from the root project's |
Expected Behavior
Using the Groovy DSL with multiple sub projects, I could apply plugins in the
subprojects
block in the root project without having the plugin applied on the root project (to be able to set common stuff in thesubprojects
block, like setting the 'java' and 'application' plugins, dependency management stuff, etc).Current Behavior
With the Kotlin DSL, I can't apply plugins in the
subprojects
block in the root project without them being included in theplugins
block. Unfortunately, this also applies the plugin on the root project and can cause some issues when trying to run tasks that are present in all subprojects (in my casedistTar
from the application plugin).Context
We should be able to apply built-in plugins on sub-projects only like when using the Groovy DSL.
External plugins work fine since we can do
apply false
in the plugins block to prevent the plugin from being applied there, but built-in plugins won't let us to this (throwing an exception telling us it would be a no-op :> Plugin 'org.gradle.application' is a core Gradle plugin, which is already on the classpath. Requesting it with the 'apply false' option is a no-op.
).Steps to Reproduce (for bugs)
I've made 2 demo projects here which I believe are the equivalent Groovy/Kotlin implementations of the same thing.
cd groovy
./gradlew[.bat] clean distTar
app1/build/distributions
andapp2/build/distribution
will have the built packagescd ../kotlin
./gradlew[.bat] clean distTar
No value has been specified for property 'mainClassName'
(for:startScripts
task)Your Environment
I couldn't get the buildscan plugin to work with the Kotlin DSL (it still outputs the Groovy DSL stuff to add to the project).
The text was updated successfully, but these errors were encountered: