[GRADLE-2999] Cannot use maven-publish to publish multiple artifacts without a classifier Created: 21/Jan/14  Updated: 11/Dec/14  Resolved: 11/Dec/14

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 2.3-rc-1

Type: Bug
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Fixed Votes: 2


I'm adding signatures to a MavenPublication. These signatures have no classifier, but do have a different extension than the file they are signing. This makes them unique in the publication. But when AbstractAntTaskBackedMavenPublisher.determineMainArtifact ([1]https://github.com/gradle/gradle/blob...) is called it throws an exception because it can't determine which is the main artifact. But the eror isn't congruent with a valid maven publication, i.e. not all artifacts require a classifier. I believe this filtering could be improved to include the POM's packaging type.

If there's a JIRA create, I could possible fix this. But it should would be nice to have a work around in the meanwhile.
[1] https://github.com/gradle/gradle/blob/master/subprojects/maven/src/main/groovy/org/gradle/api/publish/maven/internal/publisher/AbstractAntTaskBackedMavenPublisher.java#L90

Comment by Adam Murdoch [ 05/Feb/14 ]

This issue is fixed in the incubating `maven-publish` plugin. Unfortunately, we can't really fix this for the old `maven` plugin in a backwards compatible way, as the `maven` plugin uses the artefact without the classifier to determine the packaging for the module and so cannot accept multiple such artefacts.

Comment by Daz DeBoer [ 11/Dec/14 ]

I don't think Adam's comment is correct: the maven-publish plugin was disallowing multiple artifacts without a classifier. This has now been fixed: the 'main' artifact can be specified by selecting a packaging that matches that artifact's extension.

Generated at Wed Jun 30 12:37:09 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.