Ryan Schmitt
08/10/2022, 1:15 AM1.1.+
) to specify dependencies, while still publishing a Maven-compatible POM. I could use versionMapping { allVariants { fromResolutionResult() } }
, but that also strips the dynamic versions out of the Gradle metadata. I'd still like the dynamic versions to flow through all my Gradle builds, while still giving Maven-based tooling something it understands, such as a specific version, or Maven version range syntax. Any suggestions?Esa Firman
08/16/2022, 8:26 AMJens
08/18/2022, 9:19 AMproject(:) -> project(:server) -> project(:db)
(war -> java-lib -> java-lib
). Now I want to exclude a transitive dependency of an external dependency in project(:db)
and replace it with a different dependency. So I have added the replacement directly to the dependencies
block and added an exclude
for the transitive dependency. This works fine for project(:db)
itself but when displaying the dependency tree of project(:)
or project(:server)
that excluded, transitive dependency is pulled in again by project(:db)
. So in my war file nothing has effectively changed. Shouldn’t the exclude propagate?Justin Tuchek
08/19/2022, 5:28 PMDependencyConstraintHandler
to force library specific library versions across our project - like this
dependencies {
constraints {
implementation("junit:junit") {
force = true
version {
strictly("4.13.2")
}
because 'CVE-2020-15250'
}
}
}
In this particular case we're using com.squareup.okhttp3:mockwebserver:4.10.0
which uses JUnit 4.13
When running :dependencies
on our one of our modules this seems to work correctly for force upgrading all other references
There is one remaining reference in the output under apiDependenciesMetadata
as well as a junit-4.13.jar
downloaded in Gradle's cache directories
Is it expected that the results of *DependenciesMetadata
will always show the dependency version declared by the library before being upgraded with the mechanism above?
Mostly digging into this as a result of an external tool - TBD on whether the presence of the jar triggered it or the transitive dependency without awareness that it's being force upgradedEug
08/22/2022, 2:05 PMGopal S Akshintala
08/24/2022, 2:40 PMdelombok
depend on compileKotlin
. However, my delombok
fails with error: module not found:
for all the requires
modules from module-info.java
. I am unable to figure out if it’s the issue with the lombok plugin or my gradle setup. Can someone please take a look and help. Thanks!
kotlin.sourceSets.main {
kotlin.setSrcDirs(listOf(tasks.delombok))
}
tasks {
delombok {
quiet.set(true)
input.setFrom("src/main/java")
}
}
tony
08/24/2022, 6:45 PMEug
08/25/2022, 8:57 AMtony
08/26/2022, 4:16 AM> Could not resolve all files for configuration ':app:debugAndroidTestCompileClasspath'.
> Could not resolve androidx.test:monitor:1.5.0.
Required by:
project :app
> Cannot find a version of 'androidx.test:monitor' that satisfies the version constraints:
Dependency path 'integ-test:app:unspecified' --> 'androidx.test:runner:1.4.0' (compile) --> 'androidx.test:monitor:1.4.0'
Constraint path 'integ-test:app:unspecified' --> 'androidx.test:monitor:1.5.0' because of the following reason: BasePlugin
Constraint path 'integ-test:app:unspecified' --> 'androidx.test:monitor:{strictly 1.4.0}' because of the following reason: debugAndroidTestRuntimeClasspath uses version 1.4.0
Constraint path 'integ-test:app:unspecified' --> 'integ-test:app:unspecified' (debugApiElements) --> 'androidx.test:monitor:1.5.0' because of the following reason: BasePlugin
Dependency path 'integ-test:app:unspecified' --> 'androidx.test:runner:1.4.0' (compile) --> 'androidx.test.services:storage:1.4.0' (compile) --> 'androidx.test:monitor:1.4.0'
my constraint is
Constraint path 'integ-test:app:unspecified' --> 'androidx.test:monitor:1.5.0' because of the following reason: BasePlugin
where I have
constraints { handler ->
handler.add("api", "androidx.test:monitor:1.5.0") { c ->
c.because("BasePlugin")
}
}
and to reiterate, I'm just wondering what kind of constraint this is, since the error report doesn't say (in contrast to the opposing constraint, which reads as androidx.test:monitor:{strictly 1.4.0}
)Petri Kivikangas
08/26/2022, 6:33 AMMattia
08/27/2022, 6:46 PM*.module
file with a single variant which advertises the main artifact, say package-1.0.0.jar . But the repo also has extra artifacts, say package-1.0.0-sources.jar .
Now if I want to consume this, I create a configuration, add the dependency, and do configuration.resolve(). But in the resolved files, I only see package-1.0.0.jar . Is there a way through which I can receive package-1.0.0-sources.jar instead?
As I said, the extra jars are not mentioned in the module file, so the publication is flawed. But I’d like to fix this from the consumer sideTrevJonez
08/30/2022, 4:10 PMVaishnav Anil
09/02/2022, 9:08 AMJens Fischer
09/02/2022, 12:11 PMpluginManagement {
includeBuild("build-logic")
repositories {
maven("https://<nexus-host>/repository/gradle-plugin-portal")
}
}
But that fails with:
> Could not find gradle.plugin.com.google.cloud.tools:jib-gradle-plugin:3.3.0.
Searched in the following locations:
- https://<nexus-host>/repository/gradle-plugin-portal/gradle/plugin/com/google/cloud/tools/jib-gradle-plugin/3.3.0/jib-gradle-plugin-3.3.0.pom
The interesting part is the /gradle/plugin
suffix that seems to be added by Gradle, because the URL without that (https://<nexus-host>/repository/gradle-plugin-portal/com/google/cloud/tools/jib-gradle-plugin/3.3.0/jib-gradle-plugin-3.3.0.pom
) works. Is there a way to avoid that being added, or is there something else I'm missing?Mattia
09/02/2022, 1:38 PMobjects.named
in settings as far as I can see. And if I implemented the Named
with anonymous class or even top level object, I get:
org.gradle.internal.snapshot.impl.IsolationException: Could not isolate value Settings_gradle$2$1$1$1$1@4c506b93 of type Settings_gradle.....How can I achieve this?
Benjamin Gentner
09/05/2022, 9:55 AMbuildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.openjdk.nashorn:nashorn-core:15.2")
}
}
The Nashorn dependency is a JPMS module. How does Gradle load this module including service providers dynamically from a technical point of view? Can someone show the corresponding source code location? For the Spotless project something similar is needed: https://github.com/diffplug/spotless/pull/1304 There is this solution: https://stackoverflow.com/questions/62742150/how-do-i-dynamically-load-modules-from-a-directory-in-java-9 But don't know if this was done in the same way for Gradle because the ModuleLayer is needed to obtain a service from the ServiceLoader.Satyarth Sampath
09/07/2022, 1:39 PMInvalid publication ‘all’: version cannot contain ‘/’.I assume this is coming from the maven-publish plugin? Would you know what are the disallowed characters in a version name?? I was searching for a convention/documentation on this but could not find any references.
tony
09/07/2022, 5:43 PMProperty<ResolvedComponentResult>
that is the result of using an ArtifactView
on a Configuration
? Or should I do my filtering in the task action when querying the ResolvedComponentResult
?CristianGM
09/08/2022, 1:50 PMIgor Wojda
09/09/2022, 8:44 PMVersions Catalog
and I wonder can I apply subproject plugin using type safe access (libs.plugins.detekt
) ?
//libs.versions.toml
[plugins]
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
//buildgradle.kts (root)
plugins {
id("com.android.application") apply false
id("com.android.library") apply false
id("org.jetbrains.kotlin.android") apply false // or kotlin("android")
alias(libs.plugins.detekt) // type safe access to detekt plugin
}
subprojects {
apply {
plugin("io.gitlab.arturbosch.detekt") // normal access works
// Is it possible to apply plugin here using type safe access libs.plugins.detekt ?
}
}
Javi
09/13/2022, 11:33 AMapi(projects.gradleExtensionsSubprojects.gradleDelegatedPropertiesExtensions)
api(projects.gradleExtensionsSubprojects.gradleLoggingExtensions)
api(projects.gradleExtensionsSubprojects.gradleMiscellaneaExtensions)
api(projects.gradleExtensionsSubprojects.gradleProjectExtensions)
api(projects.gradleExtensionsSubprojects.gradlePropertiesExtensions)
api(projects.gradleExtensionsSubprojects.gradleTasksExtensions)
api(projects.gradleExtensionsSubprojects.gradleVersionCatalogExtensions)
Do:
for (dependency in projects.gradleExtensionsSubprojects.someWaytoGetTheList()) api(dependency)
Phanindra R
09/13/2022, 5:45 PMReload Gradle Project / Build Module
doesn't seem to work consistently.
I've had to completely remove the module and re-import most of the times.John
09/14/2022, 3:07 PMimplementation(platform("bom:1"))
in the library and implementation(enforcedPlatform("bom:2"))
in the consumer, but that causes an error. i used to do implementation(enforcedPlatform("bom:1"))
in the library, but in gradle 7 that cause the maven publish to have a validation error about publishing BOM dependencies (thread)efemoney
09/14/2022, 5:39 PMimplementation
configuration, I want to set up my build to automatically filter which dependencies inside implementation
have that extra metadata file published and pass the metadatas to my special myMetadatas
configuration.efemoney
09/14/2022, 6:00 PMRobert Elliot
09/16/2022, 12:01 PMimplementation
classpath from the testImplementation
classpath?
Context: I want to switch out one slf4j implementation (logback) for another (slf4j-test) when running my tests.Javi
09/22/2022, 12:21 PMlibs
via toml
file. But I want to override a version, if I do
versionCatalogs {
named("libs") {
version("hubdle", testVersion)
}
}
I get:
* What went wrong:
VersionCatalogBuilder with name 'libs' not found.
CristianGM
09/29/2022, 7:06 PMsomeClasspath(project(":platform:tools:http-api-model-converter", configuration = JavaPlugin.RUNTIME_ELEMENTS_CONFIGURATION_NAME))
but I got the suggestion to use instead:
val someClasspath: Configuration by configurations.creating {
isCanBeConsumed = false
isCanBeResolved = true
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
attribute(KotlinPlatformType.attribute, KotlinPlatformType.jvm)
}
}
Is it really the same? I don't see the attributes set in the java plugin (actually it seems set to the resources
)
Are attributes for each Classpath documented somewhere? What would be the best solution?CristianGM
10/04/2022, 7:43 AMEmmanuel Guerin
10/06/2022, 7:19 PM:sub:resolveSimple
that directly retrieves an artifact from the root project through a project dependency with the appropriate attributes, everything works.
When calling the task :sub:resolveTransform
that uses a configuration with a different value for an attribute, Gradle fails to find the declared transformation.