joschi
03/21/2022, 2:38 PMconfigurationName "group:name:version:classifier@extension"
https://docs.gradle.org/7.4.1/dsl/org.gradle.api.artifacts.dsl.DependencyHandler.html#N16F60
How would this look like with a reference to the version catalog?S S
03/21/2022, 5:00 PMcalc-version
2. build-image
we want to set it up so that if we have two subprojects, ParentImage
and ChildImage
we we want:
1. ChildImage:calc-version
to depend on ParentImage:calc-version
2. ChildImage:build-image
to depend on ParentImage:build-image
Is there an idiomatic way to express that? is it a bad smell?Zak Taccardi
03/21/2022, 7:37 PMbuildSrc
*.gradle.kts
files automatically generate plugin ID accessors based on file name.
For example, buildSrc/src/main/kotlin/java-library-convention.gradle.kts
automatically generates:
plugins {
`java-library-convention`
}
Is it possible to bring this behavior to an included build?Brett Guy
03/21/2022, 7:56 PM./gradlew clean build
, environment variables are resolved. However, after some amount of time passes, it seems I again lose access to environment variables and have to repeat the process.
I'm a novice at best using gradle. Any recommendations on what I can do to resolve this?Vlastimil Brecka
03/22/2022, 12:22 AMfoo-api
foo-impl
2) nested, but api and impl are on the same level
:foo
:api
:impl
3) nested, but impl is nested inside, i.e. :foo itself is a api
:foo
src ...
:impl
I’m currently doing number 2, but there are modules in the project which are not split into api/impl, lets say its some sort of formatting, or ui utils, or extensions
and the asymmetry bothers me
implementation project(":foo:contract")
implementation project(":formatters"))
wouldn’t number 3 be a cleaner solution? i.e. if its a interfaces only, or already a implementation, would be a detail, of which called dont care aboutPatrick van Zadel
03/22/2022, 8:46 AMDzmitry Neviadomski
03/22/2022, 3:16 PMbuild.gradle
compile/build classpath.
Would build cache be invalidated if I add/remove/modify line in TOML, like it happens when I modify anything in buildSrc
?Emil Kantis
03/23/2022, 12:38 PMChris
03/24/2022, 2:38 PMconfig 'com.example:artifact:1.2.3@type'
with one that uses a Version Catalog… this leaves me with:
config(libs.thingy) {
artifacts.each {
type = 'type'
}
}
This seems however to behave differently as it resolves the transitive dependency set, unlike a regular dependency declaration with a type. Is this intended?Zak Taccardi
03/25/2022, 10:48 PM"sourceImplementation"(project(":lib"))
"binaryImplementation"(
project(
path = ":lib",
configuration = "releaseAar"
)
)
How do I recreate this with project accessors?
"sourceImplementation"(projects.lib)
// I want to specify the `releaseAAr` for `binaryImplementation`
"binaryImplementation"(projects.lib) // ??
Carsten Otto
03/27/2022, 9:13 AMjoschi
03/28/2022, 2:01 PM./gradlew -Pxxx=123
) overriding this version.
So the hierarchy should be version string from file < version string from environment variable < version string from Gradle property.Deepthi Kodatham
03/28/2022, 5:35 PMMaerov Timofey
03/29/2022, 8:37 AM* What went wrong:
Could not resolve all dependencies for configuration ':runtimeClasspath'.
Problems reading data from Binary store in C:\Users\t.p.maerov\.gradle\.tmp\gradle2081162060205779659.bin offset 27644 exists? true
Unexpected parent dependency id 68. Seen ids: [2, 523, 524 ...]
Gradle 7.4 JDK 17
I try clean folder ~/.gradle but it have not result.
Full log in thread.
How can i resolve this error?Mike Cumings
03/29/2022, 8:15 PMWorkerExecutor
cannot be injected into build services and cannot be provided to it via build service parameters (Could not serialize value of type DefaultWorkerExecutor
). Is there a different/better API that can be used from build services or do I need to spin up my own thread, etc.?joschi
03/30/2022, 8:04 AMDirectory
(or rather File
) instances which try a project-specific directory and fall back to a default if it doesn't exist.
This is working:
providers.provider(() -> rootProject.layout.projectDirectory.dir("path/to/${project.name}").asFile)
.map(dir -> dir.exists() && dir.isDirectory() ? dir : null)
.getOrElse(rootProject.layout.projectDirectory.dir("path/to/default").asFile)
Is there a more elegant way to achieve the same thing? Without the map
step it will always return the project-specific directory even if it doesn't exist.Michal
03/31/2022, 10:18 AMpluginManagement {
repositories {
maven {
url = uri("https://<redacted>/artifactory/dependencies")
}
}
}
Now, my build fails with an error:
2022-03-31T120409.019+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
2022-03-31T120409.019+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Plugin [id: 'com.github.node-gradle.node', version: '3.2.1'] was not found in any of the following sources:
2022-03-31T120409.019+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2022-03-31T120409.019+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] - Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
2022-03-31T120409.019+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] - Plugin Repositories (could not resolve plugin artifact 'com.github.node-gradle.nodecom.github.node gradle.node.gradle.plugin3.2.1')
2022-03-31T120409.019+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Searched in the following repositories:
2022-03-31T120409.019+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] maven(<https://<redacted>/artifactory/dependencies>/)When debugging, I see an initial request to get the plugin descriptor POM:
2022-03-31T120409.013+0200 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Metadata of <https://<redacted>/artifactory/dependencies/com/github/node-gradle/node/com.github.node-gradle.node.gradle.plugin/3.2.1/com.github.node-gradle.node.gradle.plugin-3.2.1.pom>' completedThe POM is there and is definitely loaded. What gives? How to fix this? Thanks in advance.
S S
03/31/2022, 2:33 PMinstrumentedJars
come from? is this something that's in the gradle java plugin?joschi
03/31/2022, 3:00 PMrrva
04/02/2022, 3:59 PMgroup = "foo.barracuda"
version = "0.1.6"
tasks.register<Jar>("uberJar") {
archiveClassifier.set("uber")
outputs.doNotCacheIf("foo") { true }
from(sourceSets.main.get().output)
dependsOn(configurations.runtimeClasspath)
from({
configurations.runtimeClasspath.get().filter {
it.absolutePath.contains("myproject") && it.name.endsWith("jar")
}.map { zipTree(it) }
})
}
publishing {
publications {
create<MavenPublication>("barracuda") {
artifact(tasks["uberJar"])
}
}
}
java {
withSourcesJar()
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
this works fine but I have two problems:
• the artifact I publish does not correctly declare its dependencies so I have to pull them in manually
• sources are not included correctly for all the modules I wrote
How to fix these issues?Maerov Timofey
04/04/2022, 6:25 AMException in thread "main" java.util.zip.ZipException: zip END header not found
As i see in source timeout is 10 minutes, and i don't understand, why it failed so quickly(2-3 minutes)?Timo Grün
04/04/2022, 12:58 PM1.4.0-SNAPSHOT-20220328.122258-43
Martin
04/04/2022, 1:44 PMHervé Guillemet
04/04/2022, 3:36 PMChristoph Sturm
04/04/2022, 4:42 PMsourceSets {
main {
java.srcDir(tasks.openApiGenerate)
}
}
but in some configurations the output dir that the plugin reports is not correct because it points to the base directory where i still have to add `src/commonMain/kotlin`to get to the real source.
is the correct way to write it then
java.srcDir(tasks.openApiGenerate.get().outputDir.get()+"/src/commonMain/kotlin")
?tony
04/04/2022, 11:02 PM~/.gradle/caches/jars-9
? Can someone point me to docs? I am indeed seeing jars, and wondering how it differs from this jars one would find in ~/.gradle/caches/modules-2
Dmitry Trubin
04/05/2022, 12:48 PM./gradlew aTask theTask
is invoked, theTask
is configured and executed, but if ./gradlew aTask
is invoked, theTask
is not even configured. In other words, calling ./gradlew tasks --all
would not show theTask
at all.
Something about this bothers me, at least from task discoverability standpoint. Is this actually the way to go? Are there documented best practices for this?Nate McNamara
04/05/2022, 6:18 PM./gradlew
without specifying particular tests/classes to run, everything works. If I use the --tests
option, however, gradle runs the tests, but then exits with the "No tests found for given includes". Here is the relevant bit of the stack trace:
Caused by: org.gradle.api.tasks.testing.TestExecutionException: No tests found for given includes: [poc.MyTest](--tests filter)
at org.gradle.api.tasks.testing.AbstractTestTask.handleCollectedResults(AbstractTestTask.java:515)
at org.gradle.api.tasks.testing.AbstractTestTask.executeTests(AbstractTestTask.java:508)
at org.gradle.api.tasks.testing.Test.executeTests(Test.java:689)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Looking at the gradle source, somehow testCountLogger
is not getting notified when a test runs.
Any suggestions appreciated!Tom Gregory
04/06/2022, 5:37 PM