Quantcast
Channel: Gradle Forums - Latest posts
Viewing all articles
Browse latest Browse all 20386

Gradle using artifact with classifier instead of what I asked for. New .module file missing info

$
0
0

I’m using Gradle 6.2,
I have an artifact that has an obfuscated jar - without a classifier, and an unobfuscated jar with the classifier ‘unobfuscated’.

My build depends on the artifact without a classifier, yet the artifact that is downloaded and used is the one with the classifier.

I believe this is caused by newer Gradle versions publishing the new .module file that only mentions the unobfuscated jar.

The Gradle project that publishes the artifact in question uses the ‘maven-publish’ plugin. It has the jar task configured to use the ‘unobfuscated’ classifier, and it has a task that runs ProGuard to create a jar that is published without a classifier. It seems that Gradle is unable to get artifact that has no classifier (which is published to an Artifactory Maven repository).

How do I fix this my other project to use the jar without the classifier as it requests?

There seem to be two possibilities:
Disable the .module metadata generation

    tasks.withType(GenerateModuleMetadata) {
        enabled = false
    }

or find a way to add the obfuscated artifact with no classifier to the .module metadata.

Can that be done?

For now I have gone with the first option as it appears Gradle is broken when resolving dependencies with .module metadata in that only the artifact that was published from ‘components.java’ is resolved if it has a classifier and the artifact requested does not have a classifier.


Viewing all articles
Browse latest Browse all 20386