gold man
06/23/2024, 8:53 PMgold man
06/23/2024, 8:53 PMRun with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org.
gold man
06/23/2024, 8:54 PMgold man
06/23/2024, 8:54 PMFredrick Eisele
07/15/2024, 8:37 PMRadosław Panuszewski
08/17/2024, 6:01 PMplugins {
application // by name
java // by name
id("java") // by id - recommended
id("org.jetbrains.kotlin.jvm") version "1.9.0" // by id - recommended
}
Why is the non-typesafe plugin application id("java")
recommended over the typesafe accessor java
? For me, the typesafe one is both easier to read and easier to write (thanks to IDE autocompletion) + there is no way to make a typo. I tend to use typesafe accessors wherever possible in my buildscripts and I don't see any reason to prefer the non-typesafe plugin application 🤔Srikanta Subudhi
08/23/2024, 3:25 AMUnable to compile generated sources:- File RootProjectAccessor.java, line: 44, method getRun() is already defined in class org.gradle.accessors.dm.RootProjectAccessor
CAB
08/30/2024, 4:01 PMUnresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public inline fun RepositoryHandler.mavenCentral(vararg args: Pair<String, Any?>): MavenArtifactRepository defined in org.gradle.kotlin.dsl
Srikanta Subudhi
09/10/2024, 12:03 AMMartin
09/10/2024, 1:57 PMbuild.gradle.kts
compilation cache?Srikanta Subudhi
09/12/2024, 7:11 PMDheeraj Gupta
09/28/2024, 3:35 PMconfigurations.create("default")
artifacts {
add("default", files("1st.aar"))
add("default", file("2nd.aar"))
}
trying to add this 2 .aar files in submodules then this submodule is added in another core module like this
implementation(project(":test"))
but the only 1.aar files can be inflated in the core module
why the other '2.arr' file data is not coming in that core module
can anyone help here.Tomáš Procházka
10/21/2024, 12:22 PMTYPESAFE_PROJECT_ACCESSORS
has one strange thing.
It generate type safe accessor also for root project folder, why?
When you then try to run such project on TeamCity it fails with
org.gradle.api.InvalidUserDataException: Cannot generate project dependency accessors:
- Cannot generate project dependency accessors because project '55cb9b3dea7c8b39' doesn't follow the naming convention: [a-zA-Z]([A-Za-z0-9\-_])*
Watched directory hierarchies: [/Users/teamcity/buildAgent/work/55cb9b3dea7c8b39]
Because root project folder is 55cb9b3dea7c8b39 in this case.
For me doesn't make sense to make project dependent on the folder name where project was checkouted.
It can be anything.Kelvin Chung
10/24/2024, 6:27 PMval foobar by if (flag) {
tasks.registering(Foo::class)
} else {
tasks.registering(Bar::class)
}
fails to compile?StefMa
11/20/2024, 7:20 PMHantsy Bai
11/28/2024, 3:46 AM--debug
prarameter when building the project, and got the following build error>
11-28T11:39:13.093+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2024-11-28T11:39:13.093+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
2024-11-28T11:39:13.094+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2024-11-28T11:39:13.094+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
2024-11-28T11:39:13.094+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':compileKotlin'.
2024-11-28T11:39:13.094+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > 'void org.jetbrains.kotlin.cli.common.arguments.CommonToolArguments.setExtraWarnings(boolean)'
Hantsy Bai
11/28/2024, 4:38 AM--scan
and got the details like this.
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':compileKotlin'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:130)
•••
Caused by: java.lang.NoSuchMethodError: 'void org.jetbrains.kotlin.cli.common.arguments.CommonToolArguments.setExtraWarnings(boolean)'
at org.jetbrains.kotlin.gradle.dsl.KotlinCommonCompilerToolOptionsHelper.fillCompilerArguments$kotlin_gradle_plugin_common(KotlinCommonCompilerToolOptionsHelper.kt:15)
at org.jetbrains.kotlin.gradle.dsl.KotlinCommonCompilerOptionsHelper.fillCompilerArguments$kotlin_gradle_plugin_common(KotlinCommonCompilerOptionsHelper.kt:14)
at org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompilerOptionsHelper.fillCompilerArguments$kotlin_gradle_plugin_common(KotlinJvmCompilerOptionsHelper.kt:14)
at org.jetbrains.kotlin.gradle.tasks.KotlinCompile$createCompilerArguments$1$1.invoke(KotlinCompile.kt:239)
at org.jetbrains.kotlin.gradle.tasks.KotlinCompile$createCompilerArguments$1$1.invoke(KotlinCompile.kt:220)
at org.jetbrains.kotlin.gradle.plugin.CreateCompilerArgumentsContextImpl$ContributeCompilerArgumentsContextImpl.primitive(KotlinCompilerArgumentsProducer.kt:130)
at org.jetbrains.kotlin.gradle.tasks.KotlinCompile$createCompilerArguments$1.invoke(KotlinCompile.kt:220)
at org.jetbrains.kotlin.gradle.tasks.KotlinCompile$createCompilerArguments$1.invoke(KotlinCompile.kt:219)
at org.jetbrains.kotlin.gradle.plugin.CreateCompilerArgumentsContextImpl.create(KotlinCompilerArgumentsProducer.kt:77)
at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.createCompilerArguments(KotlinCompile.kt:526)
at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.createCompilerArguments(KotlinCompile.kt:55)
at org.jetbrains.kotlin.gradle.plugin.KotlinCompilerArgumentsProducer$DefaultImpls.createCompilerArguments$default(KotlinCompilerArgumentsProducer.kt:54)
at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.executeImpl(AbstractKotlinCompile.kt:305)
at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.execute(AbstractKotlinCompile.kt:259)
•••
Blake Oliveira
12/08/2024, 5:02 PMfinalizeDsl
hook.
plugins.withId("com.android.application") {
val androidComponents = extensions.getByType(ApplicationAndroidComponentsExtension::class.java)
androidComponents.finalizeDsl {
it.configureAndroid(extension)
}
}
Kevin Loveland
12/21/2024, 1:19 AMruntimeClasspath
configuration? I’m trying to find a transitive dependency that is causing a problem and generating a flat list of dependency would be a great help. With the help of Google, I can find outdated/Groovy ways of declaring a task, but none of these solutions seem to work.Mudasar Cheema
01/06/2025, 12:22 PMbuild.gradle.kts
i have a task for copy file from the project into .git/hooks
folder, but it wont work? Can anyone explain me what i am doing wrong here?
tasks {
withType<KotlinCompile>().configureEach {
dependsOn("ktlintFormat")
}
withType<ShadowJar>().configureEach {
enabled = true
archiveFileName.set("app.jar")
manifest {
attributes["Main-Class"] = "no.nav.sokos.prosjektnavn.ApplicationKt"
}
finalizedBy(koverHtmlReport)
}
("jar") {
enabled = false
}
withType<Test>().configureEach {
useJUnitPlatform()
testLogging {
showExceptions = true
showStackTraces = true
exceptionFormat = FULL
events = setOf(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED)
}
reports.forEach { report -> report.required.value(false) }
}
withType<Wrapper> {
gradleVersion = "8.11"
}
withType<Copy> {
val preCommitHook = file("./.git/hooks/pre-commit")
if (!preCommitHook.exists()) {
println("⚈ ⚈ ⚈ Running Add Pre Commit Git Hook Script on Build ⚈ ⚈ ⚈")
from(file("./.scripts/pre-commit"))
into(file("./.git/hooks"))
println("✅ Added Pre Commit Git Hook Script.")
}
}
}
Kelvin Chung
01/16/2025, 8:47 AMval foo by if (condition) {
tasks.registering
} else {
tasks.registering(Foo::class)
}
and I would need to do this instead:
val foo by if (condition) {
tasks.registering(DefaultTask::class)
} else {
tasks.registering(Foo::class)
}
Is this a thing in newer versions of Gradle?Suresh
01/18/2025, 9:36 PMimplementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
).
Everything is building fine, and I can publish the plugin JAR artifact to Maven Central (I’m not using Gradle plugin marker artifacts).
• Now, I want to consume the plugin in another project. The project will use a settings plugin (from the published plugin project) and the same version catalog file.
Here’s the first issue I’m encountering:
> Could not create an instance of type org.gradle.accessors.dm.LibrariesForLibs.
> Could not generate a decorated class for type LibrariesForLibs.
> org/gradle/api/internal/attributes/ImmutableAttributesFactory
I could fix this by adding the generated catalog version classes to the plugin jar artifact. However, this introduces a new issue: when the plugin is used in the consumer project, it conflicts with the version catalog classes generated there. Additionally, new entries added to the consumer’s version catalog are not showing up.
Is there any suggestion or tip on how to properly use a version catalog in this scenario, or am I complicating things here? Thanks!Thomas Keller
01/20/2025, 2:28 PMgradle/kotlin/dsl/accessors
, in total more than 900 files totalling about 4,2 MB uncompressed. Because I want to keep my upload / consumption times low I wonder if I could tell Gradle to not generate these accessors for my build convention plugins? Or is there some smart way of telling Gradle to only package those accessors that are actually used?Ken Yee
02/07/2025, 9:47 PMAdrian
03/31/2025, 1:24 PM// Without Kotlin DSL
project.tasks.named("helloWorld", HelloWorldTask::class.java)
// With Kotlin DSL
import org.gradle.kotlin.dsl.named
project.tasks.named<HelloWorldTask>("helloWorld")
André Martins
04/07/2025, 2:06 PMtesting {
suites {
getByName<JvmTestSuite>("functionalTest") {
sources {
kotlin.srcDir(layout.buildDirectory.dir("generated/api/src/main/kotlin"))
}
dependencies {
...
}
}
}
}
Maksym Moroz
04/08/2025, 12:36 PMwhen guard statements
for a gradle project (module)?Sebastian Schuberth
04/08/2025, 4:08 PMval jar by tasks.getting(Jar::class)
behaves if there are multiple Jar tasks in the project? I could not find any docs on that.Ken Yee
04/09/2025, 7:25 PMtasks.named<Test>("test") {
useJUnit()
beforeTest {
logger.lifecycle("Running unit test: $it")
}
}
It wants a closure instead for the beforeTest bit:
Argument type mismatch: actual type is 'Function0<Unit>', but '(Closure<Any!>..Closure<*>?)' was expected.
How do you specify a closure in kotlin-dsl?Claude Brisson
04/26/2025, 9:01 AMbuildSrc
directory, it looks like I have to define an explicit version for the kotlin-dsl
plugin in it.
If I don't, I get the following error:
Error resolving plugin [id: 'org.jetbrains.kotlin.multiplatform', version: '2.1.0', apply: false]
> The request for this plugin could not be satisfied because the plugin is already on the classpath with an unknown version, so compatibility cannot be checked.
But this plugin seems to have its own versioning scheme, and it's not clear to me which version to specify for a given gradle version (8.8 as it stands) and a given kotlin version (2.1.0).
Is this documented somewhere?