This message was deleted.
# community-support
s
This message was deleted.
v
Seems you use
withXml
and in the given action try to resolve the
default
configuration for some reason.
Besides that you could use a better configuration, this sounds fishy anyway and will most probably cause inconsistency between Maven POM and Gradle Module Metadata.
s
I am new to gradle and upgrading gradle, any idea on how I can use better configuration here
v
As I said, whatever you do is most probably a very bad idea anyway. So if you share your code and / or intention behind it, you might get a better recommendation. Besides that without that information it is also impossible to tell which configuration you should use instead, just that it has to be a resolvable one. This could for example be
runtimeClasspath
, or
compileClasspath
, or a custom one extending
default
to getting exactly that, ...... Heavily depending on use-case and intentions.
s
pom.withXml { def resolvedArtifacts = configurations.default.getResolvedConfiguration().getResolvedArtifacts() resolvedArtifacts.each { if(it.moduleVersion.id.group.startsWith("com.xxxxxx")) { asNode().dependencies.'*'.findAll() { dep-> it.moduleVersion.id.name == dep.artifactId.text() }.each () { dep-> dep.version*.value = it.moduleVersion.id.version }
v
Yeah, as I said, that is a very bad idea. Especially as the information written to the POM will then be inconsistent with what is written in the Gradle Module Metadata and so downstream projects using the GMM will get different things than projects using the POM. You should not use
withXml
, but instead fix the model of the build so that the intended result is produced. What exactly do you try to achieve there? It looks like you try to align versions of all libraries from
com.xxxxxx
. If so, you should better model that alignment properly using for example https://blog.gradle.org/alignment-with-gradle-module-metadata
s
@Vampire could you advise in my case how I can change my logic, I am using a customised plugin, attached plugin & projects build.gradle
v
Nope, sorry, no time for 🥄, and especially not without a proper MCVE.