Using maven-publish with multiple sourceSets (and dependencies)

I want to use maven-publish to publish an api and an impl jar to artifactory. I’m using different sourceSets for both and I want to publish one artifact per sourceSet, so:

name-api.jar name-impl.jar

Both sets have different dependencies, and I want to have clean POMs, that means I want to use the full configuration of a sourceSet. When I do this with the ‘artifact xxx’ configuration (using the already built artifact), I don’t get any dependencies in my POM. When I use ‘components.java’ I get the right dependencies in my impl pom, but it can’t upload, because I don’t have the right jar (as a main jar, without suffix, doesn’t exist). Also, when I would build a full jar, the api would be available in the impl jar, which isn’t what I want.

Can you provide any help with this matter?

I’m not sure if the new, incubating ‘maven-publish’ plugin is already capable of this. You might want to use the “old” ‘maven’ plugin instead.