Kelvin Chung
07/23/2024, 7:59 PMinterface MyDomainObject {
val isSomething: Property<Boolean>
}
and I am getting an error like
> Could not create an instance of type MyDomainObject
> Could not generate a decorated class for type MyDomainObject
> Cannot have abstract method MyDomainObject.isSomething()
This all has something to do with the fact that we have a property named isSomething
, right?Sergej Koščejev
07/24/2024, 9:27 AM./gradlew --refresh-dependencies
?Miles Peele
07/24/2024, 12:21 PMmaxParallelForks
(from Gradle's docs), setting forkEvery
to both 0
and 1
, using different JDK versions (11
and 17
), but no smoking gun yet.ASIF KAMRAN MALICK
07/24/2024, 4:20 PMtask execCopyExec{
doLast {
exec{
...
}
//some more exec methods
println csvDir // prints valid Windows absolute path
println new File(repoDir, targetDir) // prints valid Windows absolute path
copy {
from csvDir
into new File(repoDir, targetDir)
}
exec{
...
}
//some more exec methods
}
}
Roded Bahat
07/25/2024, 3:39 AMSergej Koščejev
07/26/2024, 3:16 PMproject(":foo") { ... }
. Is this something that is officially supported for use in real builds?Sergej Koščejev
07/26/2024, 3:48 PMTanish Ranjan
07/27/2024, 6:37 AMimplementation 'com.android.tools.build:gradle-api:8.5.1'
Which provided me with all the needed classes after the build. But at runtime I get ClassNotFoundException
for the classes introduced by this dependency.
Can someone help me figure out what might be the reason for it?Saad Malik
07/29/2024, 9:49 AMUnable to make progress running work. There are items queued for execution but none of them can be started
Ruth
07/29/2024, 10:09 AMdependencies {
constraints {
api("net.logstash.logback:logstash-logback-encoder") {
version {
strictly("[7,9)")
prefer("7.4")
}
}
}
api("net.logstash.logback:logstash-logback-encoder")
}
In my app I am then declaring:
dependencies{
runtimeOnly("net.logstash.logback:logstash-logback-encoder:8.0")
}
I also enabled the failOnVersionConflict()
and my gradle version is 8.9
My expectation is, that the dependency gets resolved to 8.0 as the library restricts the version between 7 (inclusive) and 9 (exclusive), and only if no other versions are specified it should take version 7.4,
Instead I get a dependency conflict:
Dependency resolution failed because of conflict on the following module:
- net.logstash.logback:logstash-logback-encoder between versions 8.0 and 7.4
net.logstash.logback:logstash-logback-encoder:8.0
Variant runtime:
| Attribute Name | Provided | Requested |
|------------------------------------|--------------|--------------|
| org.gradle.status | release | |
| org.gradle.category | library | library |
| org.gradle.libraryelements | jar | jar |
| org.gradle.usage | java-runtime | java-runtime |
| org.gradle.dependency.bundling | | external |
| org.gradle.jvm.environment | | standard-jvm |
| org.gradle.jvm.version | | 21 |
| org.jetbrains.kotlin.platform.type | | jvm |
Selection reasons:
- By constraint
- By conflict resolution: between versions 8.0 and 7.4
net.logstash.logback:logstash-logback-encoder:8.0
\--- runtimeClasspath
net.logstash.logback:logstash-logback-encoder -> 8.0
\--- library:2024-07-29T11-44-27
\--- runtimeClasspath (requested library:+)
net.logstash.logback:logstash-logback-encoder:{strictly [7,9); prefer 7.4} -> 8.0
\--- library:2024-07-29T11-44-27
\--- runtimeClasspath (requested library:+)
Eug
07/29/2024, 11:49 AMgradle-tooling-api
on the maven central? I'm trying to download gradle profiler and I'm getting that API dependency is not availableNiels Doucet
07/29/2024, 12:35 PMgradle module
\-- convention plugin
\-- in-house published plugin
\-- helm plugin
See thread for more detail.Gábor Török
07/29/2024, 11:30 PMsourceSet
for our generated code.
i am working on a kotlin plugin for our build - the goal is that each project that has generated code should produce a single jar that contains all the generated and non-generated files.
I was able to achieve this:
val mainSourceSet = extensions.getByType<SourceSetContainer>().named("main").get()
val generatedSourceSet: SourceSet = extensions.getByType<SourceSetContainer>().create("generated") {
it.java.srcDir(outputDir)
it.compileClasspath += mainSourceSet.compileClasspath
}
mainSourceSet.apply {
compileClasspath += generatedSourceSet.output
}
tasks.named<Jar>("jar") {
from( generatedSourceSet.output )
}
with this, all the expected classes show up in the jar
however the problem is that in builds that include this build, we get a compilation error when we refer to any of the generated classes - and i can't figure out what's going wrong.Adam
07/30/2024, 7:06 AMinit.gradle(.kts)
in the $GRADLE_HOME/init.d/
directory." What is GRADLE_HOME
? Is it $projectDir/.gradle/
?Piotr Krzemiński
07/30/2024, 9:38 AMSergej Koščejev
07/31/2024, 6:31 AMASIF KAMRAN MALICK
07/31/2024, 8:52 AMtask downloadDeps {
doLast {
def libDir = file("${buildDir}/lib")
if (!libDir.exists()) {
libDir.mkdirs()
}
dependencyList.each { dep ->
println "Downloading from: ${dep}"
exec {
workingDir libDir
commandLine 'curl', '-f', '-#', '-OJ', "${dep}"
}
}
}
}
What mistake am I doing here?jonathan gafner
07/31/2024, 12:00 PMMatthew Von-Maszewski
07/31/2024, 9:06 PMMatthew Von-Maszewski
08/01/2024, 9:27 PMEug
08/02/2024, 3:11 PMsystemProp.http.proxyHost=localhost
systemProp.http.proxyPort=9090
systemProp.https.proxyHost=localhost
systemProp.https.proxyPort=9090
were addedEug
08/02/2024, 3:12 PMAdam
08/03/2024, 11:53 AMJavi
08/03/2024, 2:43 PMinternal val Project.kotlinSourceSetMainOrCommonMainOrNull: NamedDomainObjectSet<KotlinSourceSet>?
get() =
extensions.findByType<KotlinProjectExtension>()?.sourceSets?.named { name ->
name == "main" || name == "commonMain"
}
project.kotlinSourceSetMainOrCommonMainOrNull?.configureEach { sourceSet ->
sourceSet.kotlin.srcDirs(generateProjectDataTask)
}
Looks like some source sets are missing, I thought named
+ configureEach
would be lazy.Kyle Wood
08/03/2024, 7:30 PMval filtered = Attribute.of("filtered", Boolean::class.javaObjectType)
configurations.runtimeClasspath {
// require artifacts be filtered
attributes.attribute(filtered, true)
}
dependencies {
attributesSchema {
attribute(filtered)
}
// mark everything as "filtered true" by default, so the transformer doens't normally run
artifactTypes.getByName("jar") {
attributes.attribute(filtered, true)
}
registerTransform(FilterNativeLibraries::class) {
from.attribute(filtered, false)
to.attribute(filtered, true)
}
// ..other dependencies
implementation("org.duckdb:duckdb_jdbc:1.0.0")
components {
// mark a single variable of a single module as "filtered false" so the transformer does run on it
withModule("org.duckdb:duckdb_jdbc") {
withVariant("runtime") {
attributes.attribute(filtered, false)
}
}
}
}
And that does seem to do what I want in terms of the runtime
variant does appear to have the filtered: false
attribute on it:
Incompatible because this component declares a component, as well as attribute 'filtered' with value 'false' and the consumer needed a component, as well as attribute 'filtered' with value 'true'
So I would expect the transformer I defined to run on it, but it's not executing for some reason.
I've also tried a different approach, where I define the attribute requirement only on a single configuration which runtimeClasspath
depends on, but that doesn't seem to work either because transformation is only applied on configurations when they are resolved, and only the root configuration is actually resolved, so that requirement on the filtered
configuration doesn't seem to do anything.Kyle Wood
08/03/2024, 9:33 PMArchiveOperations.zipTree
but for creating zip files? I know there is the Zip
task but that can't be used inside an artifact transform.JC
08/04/2024, 11:02 PMSergey Chelombitko
08/05/2024, 3:28 PMBuildService
from the code consuming a plugin?
I cannot pass a listener via service parameters, because they have to be Serializable
, but the listener is not.
So far, I haven't found a better way that passing the listener via a singleton object:
// Inside the plugin:
object MyListenerHolder {
var listener: MyListener? = null
}
abstract class MyService : BuildService {
val logic by lazy {
Logic(MyListenerHolder.listener)
}
}
// Consumer code:
plugins.withId("com.myplugin") {
MyListenerHolder.listenter = MyListenerImpl()
}
Parag Chandra
08/05/2024, 4:05 PMincludeBuild(featureA)
and featureA
in turn includeBuild(libraryB)
and so on, how can I get a task reference to something like :libraryB:unitTest
from the top-level project? right now i can only seem to get task references one level deep, e.g. `featureAunitTest`; but not :featureA:libraryB:unitTest
or :libraryB:unitTest
.Jakub Chrzanowski
08/05/2024, 7:59 PMexclusiveContent
filters defined twice – none of the repositories is eventually picked for the dependency resolution. Is that an expected/known issue?
plugins {
id("java")
}
repositories {
mavenCentral {
exclusiveContent {
forRepositories(this@mavenCentral)
filter {
includeGroup("junit")
includeGroup("org.hamcrest")
}
}
}
mavenCentral {
exclusiveContent {
forRepositories(this@mavenCentral)
filter {
includeGroup("junit")
includeGroup("org.hamcrest")
}
}
}
}
dependencies {
testImplementation("junit:junit:4.13.2")
}
This fails with:
foo:test: Could not find junit:junit:4.13.2.
Required by:
project :