Cannot set maven main artifact when publishing


(Stefan Wolf) #1

Currently, it is not possible to set the maven main artifact when publishing. It seems like the old (Upload-Task) and the new (Publishing) maven publishing does not support setting the main artifact. Both seem to try to autodetect the main artifact (the one with no classifier?). When I try to publish two artifacts without classifier (for example a jar and a jpi file) and set the packaging to something which is not jar (or war, ear, …), then the maven deployer complains that there are two main artifacts. But I want to publish one file as the main artifact and the jar file as an attached artifact without classifier. The usecase for this is building Jenkins plugins with gradle. The jenkins plugin for maven has no problems in publishing a jpi and a jar file having packaging ‘jpi’ in the pom. See also http://forums.gradle.org/gradle/topics/how_to_publish_a_jar_and_a_jpi_file_at_the_same_time, which describes the concrete usecase in more details, but did not get an answer.