Jonathing
10/15/2025, 12:52 PMProject, ConfigurationContainer, and SoftwareComponentFactory, despite not being listed in the Service Injection userguide page. So my question is, is this page out-of-date or is injecting those other types unsafe? Does Gradle hold the right to make injecting type Project stop working at any time?Rahul Srivastava
10/27/2025, 8:05 AM/**
* Copyright Β© 2016-2025 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* <http://www.apache.org/licenses/LICENSE-2.0>
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id "nebula.ospackage" version "8.6.3"
}
buildDir = projectBuildDir
version = projectVersion
distsDirName = "./"
// OS Package plugin configuration
ospackage {
packageName = pkgName
version = "${project.version}"
release = 1
os = LINUX
type = BINARY
into pkgInstallFolder
user pkgUser
permissionGroup pkgUser
// Copy the actual .jar file
from(mainJar) {
// Strip the version from the jar filename
rename { String fileName ->
"${pkgName}.jar"
}
fileMode 0500
into "bin"
}
if("${pkgCopyInstallScripts}".equalsIgnoreCase("true")) {
// Copy the install files
from("${buildDir}/bin/install/install.sh") {
fileMode 0775
into "bin/install"
}
from("${buildDir}/bin/install/upgrade.sh") {
fileMode 0775
into "bin/install"
}
from("${buildDir}/bin/install/logback.xml") {
into "bin/install"
}
}
// Copy the config files
from("${buildDir}/conf") {
exclude "${pkgName}.conf"
fileType CONFIG | NOREPLACE
fileMode 0754
into "conf"
}
// Copy the data files
from("${buildDir}/data") {
fileType CONFIG | NOREPLACE
fileMode 0754
into "data"
}
// Copy the extensions files
from("${buildDir}/extensions") {
into "extensions"
}
}
// Configure our RPM build task
buildRpm {
arch = NOARCH
archiveVersion = projectVersion.replace('-', '')
archiveFileName = "${pkgName}.rpm"
requires("(java-17 or java-17-headless or jre-17 or jre-17-headless)") // .or() notation does work in RPM plugin
from("${buildDir}/conf") {
include "${pkgName}.conf"
filter(ReplaceTokens, tokens: ['pkg.platform': 'rpm'])
fileType CONFIG | NOREPLACE
fileMode 0754
into "${pkgInstallFolder}/conf"
}
preInstall file("${buildDir}/control/rpm/preinst")
postInstall file("${buildDir}/control/rpm/postinst")
preUninstall file("${buildDir}/control/rpm/prerm")
postUninstall file("${buildDir}/control/rpm/postrm")
user pkgUser
permissionGroup pkgUser
// Copy the system unit files
from("${buildDir}/control/template.service") {
addParentDirs = false
fileMode 0644
into "/usr/lib/systemd/system"
rename { String filename ->
"${pkgName}.service"
}
}
link("${pkgInstallFolder}/bin/${pkgName}.yml", "${pkgInstallFolder}/conf/${pkgName}.yml")
link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")
}
// Same as the buildRpm task
buildDeb {
arch = "all"
archiveFileName = "${pkgName}.deb"
requires("openjdk-17-jre").or("java17-runtime").or("oracle-java17-installer").or("openjdk-17-jre-headless")
from("${buildDir}/conf") {
include "${pkgName}.conf"
filter(ReplaceTokens, tokens: ['pkg.platform': 'deb'])
fileType CONFIG | NOREPLACE
fileMode 0754
into "${pkgInstallFolder}/conf"
}
configurationFile("${pkgInstallFolder}/conf/${pkgName}.conf")
configurationFile("${pkgInstallFolder}/conf/${pkgName}.yml")
configurationFile("${pkgInstallFolder}/conf/logback.xml")
configurationFile("${pkgInstallFolder}/conf/actor-system.conf")
preInstall file("${buildDir}/control/deb/preinst")
postInstall file("${buildDir}/control/deb/postinst")
preUninstall file("${buildDir}/control/deb/prerm")
postUninstall file("${buildDir}/control/deb/postrm")
user pkgUser
permissionGroup pkgUser
// Copy the system unit files
from("${buildDir}/control/template.service") {
addParentDirs = false
fileMode 0644
into "/lib/systemd/system"
rename { String filename ->
"${pkgName}.service"
}
}
link("${pkgInstallFolder}/bin/${pkgName}.yml", "${pkgInstallFolder}/conf/${pkgName}.yml")
link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")
}
build.gradle and encountering error
startup failed:General error during conversion: Unsupported class file major version 69 while compiling i am using openjdk version 17 i need help in this i am running this on mac machine
Giuseppe Barbieri
11/10/2025, 9:31 AMcontext(project: Project)
operator fun String.invoke(): String {
val output = ByteArrayOutputStream()
project.providers.exec {
commandLine(split(Regex("\\s+")))
standardOutput = output
}
return output.toString().trim()
}
but whenever I try to execute some command, I do get
> An exception occurred applying plugin request [id: 'io.github.theapache64.korduino.gradle', version: '0.0.1']
> > Failed to apply plugin 'io.github.theapache64.korduino.gradle'.
> > Could not create provider for value source ProcessOutputValueSource.thadhouse
11/10/2025, 6:25 PMAlex Beggs
11/11/2025, 12:58 AMbuildMyDemo and have it find any buildMyDemo tasks in the subprojects and execute them.
I have come up with two solutions:
Option 1:
1. Register buildMyDemo in every project
2. Configure buildMyDemo when necessary in the appropriate subproject
Option 2:
1. Register buildMyDemo in the rootProject once
2. Configure buildMyDemo when necessary in the appropriate subproject
My question comes down to performance. How much worse is Option 1 vs 2? I have ~800 subprojects. I'm planning on implementing Option 2, but I wanted to understand the impact of register across all of the projects.John
11/11/2025, 6:08 PMoutgoingVariants has this (which is the one I am trying to resolve to)
Secondary Variants (*)
--------------------------------------------------
Secondary Variant archRulesElements
--------------------------------------------------
Attributes
- org.gradle.category = library
- org.gradle.dependency.bundling = external
- org.gradle.jvm.version = 21
- org.gradle.libraryelements = jar
- org.gradle.usage = arch-rules
Artifacts
build/libs/library-with-rules-archrules.jar (artifactType = jar, classifier = archrules)
but when I select
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, project.objects.named<Category>(Category.LIBRARY))
attribute(Bundling.BUNDLING_ATTRIBUTE, project.objects.named<Bundling>( Bundling.EXTERNAL))
attribute(Usage.USAGE_ATTRIBUTE, project.objects.named<Usage>( "arch-rules"))
}
it matches no artifacts. any ideas? maybe there is a common gotcha I am missing?John
11/20/2025, 8:46 PMJohn
12/12/2025, 5:06 PMAndres Almiray
12/26/2025, 10:36 PMproject instance (such as name, description, etc) and other properties defined in gradle.properties for example. As I understand values should be sources from providers, as well as avoid keeping references to βunsactionedβ things such as the project instance and non-serializable types.
Is it OK to pass the project instance to the constructor (using @Inject of course) and derive all needed providers from there? Or should I pass all required providers as constructor args?
TIAJonathing
01/01/2026, 11:23 PMcompileJava task will depend on. The problem is that the compileClaspath configuration is resolved before task execution. So, by the time my task, which produces artifacts in a fake Maven repository that's added to the repositories, finishes execution, it will be too late and compileJava will fail with an error saying it can't find the (package from) dependency it's looking for. Any thoughts on how to better tackle this?
I've already tried doing this fake Maven generation in configuration time itself, but that completely breaks Configuration Cache since it involves running ExecOperations#javaExec.Remi Gelinas
02/15/2026, 3:55 PMLex Manos
02/19/2026, 4:57 AMtasks.named(name, type){} Intellij correctly determines the closure type. When held in a variable it does not.
See attached screenshot
Both configuration handlers work (the json is printed twice)
However when i try to do the same thing that tasks.named does with my own code I run into issues.
Long story short, I am trying to write a helper method that registers multiple tasks.
this.json = tasks.register(name + "Json", InstallerJson.class);
public TaskProvider<@NotNull InstallerJson> getJson() {
return this.json;
}
public void json(Action<? super InstallerJson> action) {
getJson().configure(action);
}
When I do:
inst.json {
prop = value
}
IntelliJ sees the argument type correctly, but I get Could not set unknown property 'prop' for root project 'root' of type org.gradle.api.Project.
When I do:
inst.json.configure {
prop = value
}
IntelliJ says the argument is of type T but it executes correctly.
Any suggestions on how to make both sides happy?Remi Gelinas
02/21/2026, 3:13 AMJohn
02/27/2026, 7:44 PMRemi Gelinas
03/02/2026, 1:48 PMClayton Walker
05/07/2026, 4:39 PMJonathan Leitschuh
05/12/2026, 8:47 PMLeon Linhart
05/13/2026, 10:31 AMorg.gradle.internal.exceptions.NonGradleCause)? I initially assumed it would be sufficient to use a VerificationException but that is still reported as if there was a technical build failure rather than a semantic failure. (Example in π§΅)no
05/19/2026, 12:29 PM@Input.
My understanding is that task inputs are hashed and not placed in the build cache in plain text. However running the build with --debug would print this key in plain text.
So the question is: Is it best practice to mark API keys as @Input or @Internal?Clayton Walker
05/28/2026, 4:02 PMgradle.properties file?Louis Jacomet
06/03/2026, 1:25 PMplugin-publish plugin may no longer allow publications of plugins to the Gradle plugin portal.
The specific version in question is 0.11.0. We will be investigating if we broke compatibility accidentally and then share an update on this.
But in the meantime, 1.0.0 was released in June 2022 and the latest version is now 2.1.1. We recommend you update this plugin to make sure you do not run in such issues.John
07/09/2026, 8:42 PMValueSources that do expensive things (like execute git, etc), and I want to share these across multiple plugins so that I don't have to duplicate code, as well as create multiple providers for the same thing, I had an idea to put them in a BuildService. however, it seems like if I create the providers in order to pass them to the service via params, then they get run, even if the build service method that returns that provider never is called. I had an idea to create the providers only when they are accessed via build service, but to do that, id need a reference to ProviderFactory as a param, but I don't think that is serializable (for CC). is there an established pattern here?John
07/15/2026, 5:10 PMConfiguration object in a task that is configuration cache safe? I don't want to treat it like files because I want to look at the declared dependencies and resolved dependency tree modelPhilip W
08/05/2026, 7:29 AMJohn
08/12/2026, 5:58 PMtony
08/13/2026, 10:18 PMLex Manos
08/19/2026, 8:44 AMPlugin with id 'my-java-convention-b' not found. error.
If i comment out the application of my-java-convention-b in app\build.gradle and run projects it shows both includeBuilds loaded.
So I am really confused.
Yes, I could move build-logic-b\convention to build-logic-a\convention-b but that doesn't solve the actual issue.
To explain the actual issue, I am trying to reorganize a very large project into multiple projects with shared sources. Using a hybrid of an external java-gradle-plugin and a in-repo build-logic project.
I can get the in-repo build-logic to work, and reference the built external plugin, however the issue comes when i try to develop both at the same time.
includeBuild 'build-logic'
includeBuild 'forgedev' // Checked out in a sub-directory, could be anywhere
Results in the normal build-logic gradle file not being able to be compiled with tons of errors saying it cant find groovy.
Commenting out the 2nd includeBuild fixes the compile issues.
So ya, there are two issues. The first is when trying to make a test workspace, the second is when trying to integrate into a real project.
Maybe im missing something really simple, but I tried searching the gradle github and didn't find anything says that only one includeBuild works for build-logic. On the contrary I've found tons of examples of it saying that multiple work. Ive been going at this for all weekend, and finally exhausted what i can figure out myself.Marek
08/19/2026, 7:12 PMclean tasks. My understanding is that if my plugin applies the Base plugin as well, I get them for free. Both the global clean and clean<task name> for each registered task. Is it a proper approach?ysb33r
08/26/2026, 5:59 PMorg.gradle.nativeplatform.OperatingSystemFamily attributes for publishing JARs that should only be selected on specific operating systems? Or are these purely for native development artifacts?tony
08/26/2026, 7:22 PM