How can I add a Maven classifier property upon pom generation?

I am working on the conversion of an existing Ant/file build infrastructure towards a Gradle/Artifactory infrastructure. But I am having troubles with a multi-project multi-artifact configuration.

My root project basically comprises a configuration project with configuration injection. Subprojects work with a shared source directory and have to be linked against platform-specific API’s. Therefore, I would like to reuse the classifier attribute to indicate to which API version it was build. I am also using external tooling to create platform specific builds, for which no gradle plugins exist (yet). I can easily re-use this tooling by making use of ant and the gradle-ant integration structure, which works great by the way. I am especially pleased with the possibility of setting Ant classpaths with Gradle configurations which provides a seamless integration path, with gradle dependency management as a bonus!

I can build my root project and generate multiple artifacts attached to it, however only the root pom is published when I deploy to artifactory using uploadArchives. I want to generate a seperate pom for each extra artifact with a custom maven classifier, because the code is the same, but the platform API’s vary. There was a wiki entry that describes pom filtering, but the maven classifier attribute is just not recognised.

I can see in the APIDocs that the PomModel doesn’t export the classifier attribute, so how can I achieve this?

No one? I really need this… Any alternatives available?

The Gradle user guide explains how to generate multiple POMs per project. It also explains how to post-process a POM, either via its object model (and this is Maven’s own object model) or on the XML level. See 38.6 Maven POM generation. Also have a look at samples/maven/pomGeneration in the full Gradle distribution.

Thanks for pointing me in the right direction. I looked at the samples which worked pretty well for me. However, my problem was that I wanted to generate the same POM with only an extra classifier property which holds a different jar and make it part of a central build. Apparently, this is not a valid use-case for Maven2. If you specify a classifier, it is always added as an extra artifact without a pom, because Maven2 versions with a build-number and timestamp, without the classifier taken into account. This seems to be solved in Maven3. Therefore, the classifier property is not exposed in the PomModel.

Solution: - 1 project for each platform build OR - disable uniqueVersion OR - Do some custom generation and switch to Maven 3

This case is closed for me.