Sergej Koščejev
11/13/2024, 11:29 AMThomas Broyer
11/13/2024, 11:48 AMThomas Broyer
11/13/2024, 11:49 AM<scope>provided</scope> is of real value for a published library; it's mainly useful for declaring some dependencies in a <packaging>war</packaging> Maven project; ymmv)Sergej Koščejev
11/13/2024, 11:58 AMconfigurations.mps) as well as a configuration for specifying the dependencies of the artifact (configurations.languageLibs). I would like the languageLibs to be mapped to compile dependencies but mps to be mapped to provided in the generated POM (just for information).
So I define a consumable configuration with my artifact (configurations.languages) that extends languageLibs and use component.addVariantsFromConfiguration(languages) { mapToMavenScope("compile") }. But the API doesn't let me specify "use 'compile' for this extended configuration but 'provided' for that one" or something like that.
I could adjust the Maven POM directly using withXml but I'm trying to understand why things are modeled the way they are. After all, many existing Maven artifacts have both compile and runtime dependencies in the POM while also providing just one artifact.
Can I perhaps create an outgoing configuration without an artifact, just with dependencies, and use that one in the component?Vampire
11/13/2024, 12:03 PMwithXml is almost always a bad idea, especially if you also publish Gradle Module Metadata, which is the default, as then the information in the two files is different. It is usually always preferable to fix the model, so that the correct result is produced.Vampire
11/13/2024, 12:04 PMmapToMavenScope, while this might also not fully produce consistent results, not sure.Sergej Koščejev
11/13/2024, 12:17 PMYes, hence the question.is almost always a bad idea, especially if you also publish Gradle Module Metadata, which is the default, as then the information in the two files is different. It is usually always preferable to fix the model, so that the correct result is produced.withXml
To select the maven scope for a configuration you would normally useIt’s consistent all right, just not powerful enough, or I’m missing something., while this might also not fully produce consistent results, not sure.mapToMavenScope
Sergej Koščejev
11/13/2024, 12:58 PMmapToMavenScope won’t accept ‘provided’, only ‘compile’ or ‘runtime’. Sad.Sergej Koščejev
11/13/2024, 12:59 PMVampire
11/13/2024, 1:25 PMActually, it looks likeOh, sorry, forgot about that as I very rarely used that functionality, but you are right and it is as designed: https://github.com/gradle/gradle/issues/14934won’t accept ‘provided’, only ‘compile’ or ‘runtime’. Sad.mapToMavenScope