Andrzej Zabost
09/18/2025, 11:54 AMplugins {
id("jacoco")
// ... everything else
}
tasks.withType<Test> {
configure<JacocoTaskExtension> {
excludes = listOf(
"com.example.*",
)
}
}
but it doesn't seem to do anything.
I tried different formats, like com.example.**
, com/example/*
and com/example/**
, but none of them worked.
How do I correctly do this?
Btw I'm running coverage from IDE by just executing a Gradle task with the coverage option.
I know I can edit the "run configuration" and add the excludes in the IDE's UI, but I'd rather have a global configuration in Gradle.Jatin Garg
09/18/2025, 12:38 PMJatin Garg
09/18/2025, 12:40 PMtony
09/18/2025, 10:03 PMtest
task is not running all my tests and I cannot figure out why. I've run it with -i
and -d
and don't see anything in the logging. I've also used --rerun
and --no-configuration-cache
just in case there was something there. There is one test that gets run this way, but it ends up being SKIPPED for unclear reasons. If I use --tests Foo
, then Foo
test does run. I've never seen this before and I'm mystified.
I'm using junit5 and have the following dependencies, among others
# libs.versions.toml
junitEngine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junitJupiter" }
junitLauncher = { module = "org.junit.platform:junit-platform-launcher", version.ref = "junitPlatformLauncher" }
// build.gradle.kts
testRuntimeOnly(libs.junitEngine)
testRuntimeOnly(libs.junitLauncher)
SW
09/19/2025, 6:19 AM* What went wrong:
Plugin [id: 'com.github.johnrengelman.shadow', version: '7.0.0'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'com.github.johnrengelman.shadowcom.github.johnrengelman.shadow.gradle.plugin7.0.0')
Searched in the following repositories:
Gradle Central Plugin Repository
* Try:
Run with --stacktrace option to get the stack trace.
Run 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 CONFIGURE FAILED in 19s
Niels Doucet
09/19/2025, 10:39 AMDefaultGradlePropertiesController#loadGradlePropertiesFrom
, but that moved to an internal package with gradle 9.
I'd really like to avoid relying on internal classes.Robert Elliot
09/19/2025, 3:39 PMsettings.gradle.kts
if (file("settings-include.gradle.kts").exists()) {
apply(from = "settings-include.gradle.kts", optional = true)
}
.gitignore
settings-include.gradle.kts
settings-include.gradle.kts
includeBuild("../other-project")
Then you can just comment that line in settings-include.gradle.kts
in and out.
Is this how everyone else is doing it?Adam
09/19/2025, 7:18 PMfoo-lib
publishes text files to GAV org.demo:foo-lib-text
and repo path org/demo/foo-lib-text/
, and json files to org.demo:foo-lib-json
with path org/demo/foo-lib-json/
. The main variant is published to org/demo/foo-lib/
.
Is this possible? I tried adding feature variants but they use the same directory, but with a different directory.Sergej Koščejev
09/22/2025, 11:48 AMThomas Keller
09/22/2025, 2:23 PMSettingsPlugin
) to one using a central gradle/libs.versions.toml
file to support GHs Renovate bot in a multi-component build. Previously I had this specific settings plugin applied to all of my sub component's settings like this:
pluginManagement {
includeBuild("../build-settings")
}
plugins {
id("my.custom.settings.plugin")
}
and it all worked fine. Now that move to that libs.versions.toml
I cannot get this working any longer, since each subcomponent has it's own reference to a gradle
subdir, i.e. ROOT/gradle/libs.versions.toml
exists, but ROOT/subcomponent/gradle/libs.versions.toml
obviously does not and if I try to manually "correct" that like this via
if (!settings.project(":").name.contains("monorepo")) {
settings.dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(
settings.layout.settingsDirectory.file("gradle/libs.versions.toml")
)
}
}
}
}
I get ROOT/subcomponent/gradle/
referenced and even if I fix that, Gradle will still tell me
java.lang.RuntimeException: org.gradle.internal.typeconversion.UnsupportedNotationException: Cannot convert the provided notation to an object of type Dependency: /local/path/to/monorepo/gradle/libs.versions.toml.
The following types/formats are supported:
- String or CharSequence values, for example 'org.gradle:gradle-core:1.0'.
- Maps, for example [group: 'org.gradle', name: 'gradle-core', version: '1.0'].
- FileCollections, for example files('some.jar', 'someOther.jar').
- Projects, for example project(':some:project:path').
- ClassPathNotation, for example gradleApi().
So what am I doing wrong / how can I effectively share a TOML version catalogue in a multi-component scenario?ysb33r
09/22/2025, 6:33 PMNik Ammerlaan
09/22/2025, 10:34 PMMarkus Maier
09/23/2025, 8:24 AMCopy
task with data from a file produced by another task. Currently that's done by cross-configuring the second task from the first. I'm trying to find a better way, but so far have come up empty. Do you have any pointers for me, or am I stuck with using cross-configuration?Jatin Garg
09/23/2025, 1:59 PMColton Idle
09/23/2025, 4:33 PMAdam
09/23/2025, 8:53 PMnet.rubygrapefruit:native-platform
in a pet project but it has a lot of variants for specific OSes that are downloaded unnecessarily. It seems to be published without Gradle module metadata. Is there an existing ComponentMetadataRule so I can only download a suitable variant for the current OS & arch?Mike Wacker
09/24/2025, 10:57 PM# syntax=docker/dockerfile:1
FROM eclipse-temurin:21-jdk AS build
WORKDIR /src
COPY gradle/ gradle/
COPY gradle.properties gradlew ./
RUN ./gradlew --no-daemon --version
COPY buildSrc/ buildSrc/
RUN touch settings.gradle.kts
RUN ./gradlew --no-daemon build
COPY . .
RUN ./gradlew --no-daemon installDist
FROM eclipse-temurin:21-jre
WORKDIR /app
COPY --from=build /src/app/build/install/app/ ./
COPY --from=build /src/docker/config/ config/
CMD ["bin/app", "server", "config/config.yml"]
Aside: it still seems like the buildSrc
tasks take a significant, non-zero amount of time in the RUN ./gradlew --no-daemon installDist
layer, but overall, this layer does seem to be faster if you build buildSrc
in an earlier layer.Stylianos Gakis
09/25/2025, 10:25 AMimplementation(platform(libs.okhttp.bom))
in all places where I add any okhttp dependency?
Conceptually, something like
subprojects {
dependencies {
implementation(platform(libs.okhttp...
but I can't seem to find the proper way to do this.Fanish
09/26/2025, 8:51 AMtasks.register('compileJasperReports') {
dependsOn classes
doLast {
def jasperOut = jasperOutDir.get().asFile
jasperOut.mkdirs()
ant.taskdef(
name: 'jasper',
classname: 'net.sf.jasperreports.ant.JRAntCompileTask',
classpath: jasperCompileClasspath.asPath
)
ant.jasper(
destdir: jasperOut,
srcdir: jasperSrcDir,
includes: jasperIncludes
) {
classpath {
pathelement(path: mainOutputClassesDirs.asPath)
pathelement(path: mainOutputResourcesDir)
pathelement(path: compileClasspath.asPath)
pathelement(path: jasperCompileClasspath.asPath)
}
}
}
}
but the build is failing with
14:08:04 FAILURE: Build failed with an exception.
14:08:04
14:08:04 * What went wrong:
14:08:04 Java heap space
I have added this in gradle.properties
org.gradle.jvmargs=-Xmx12g -XX:MaxMetaspaceSize=2g -XX:+HeapDumpOnOutOfMemoryError
What is cousing this issue?Nobara_Vinny
09/26/2025, 8:57 AMNobara_Vinny
09/26/2025, 8:58 AMNobara_Vinny
09/26/2025, 9:03 AMRun with --stacktrace option to get the stack trace.
Run 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 BUILD FAILED in 5s
Caleb Cushing
09/26/2025, 12:10 PM./gradlew mytask
even just running ./gradlew
would execute itCaleb Cushing
09/26/2025, 12:30 PM.git/config
that I never need to read in the task (it's just for change detection to decide with the task needs to be run
@Input
val gitConfig = project.layout.projectDirectory.dir(".git").file("config")
is right? I don't ever need filename
so this feels unintitive in a way.
Also since the task technically mutates it, should it have both input and output on the same property?
basically I want to run git config core.hooksPath .config/git/hooks
but only if it hasn't been runJohn
09/30/2025, 2:08 PM> Could not resolve all artifacts for configuration 'classpath'.
> Failed to transform xxx-main.jar (project :plugin) to match attributes {artifactType=jar, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.internal.instrumented=instrumented-only, org.gradle.jvm.environment=standard-jvm, org.gradle.jvm.version=8, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=jvm}.
> Execution failed for ProjectDependencyInstrumentingArtifactTransform: /home/xxx-main.jar.
> java.io.FileNotFoundException: File system element for parameter 'source' does not exist: '/home/xxx-main.jar'
The plugin produces the shadow jar without the main
classifier. so my thought was to do a custom dependency substitution like this
variant(module("myplugin")) {
attributes{
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling.SHADOWED))
}
}
however, it seems the objects
reference doesn't exist in settings.gradle. is there anyway to set an attribute in an included build dependency substitution?Fanish
10/01/2025, 8:53 AMI am using a war task in my gradle project, The idea is to get the web.xml file in war artifact created and in that copied file there is one parameter <param-value>${springActiveProfile}</param-value>which should have the value given in def springActiveProfile = 'sync,prodPropertySetup'.
But my below added task is not working as it is not editing the web.xml
def springActiveProfile = 'sync,prodPropertySetup'
war {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveBaseName = "Sync"
// Normal webapp content
from("src/main/webapp")
// Override just web.xml with expansion
from("src/main/webapp/WEB-INF") {
include "web.xml"
into "WEB-INF"
expand(springActiveProfile: springActiveProfile)
}
}
Slackbot
10/01/2025, 9:28 AMSofia Louisy
10/01/2025, 10:09 AMKanstantsin Shautsou
10/01/2025, 11:28 AMJoseph Ottinger
10/01/2025, 5:58 PM