Problem with publishing with maven-publish in a multi module project II


(Jan Rodan) #1

Hi,

I try to use the maven-publish plugin to publish jars to a nexus repository in a multi module project.
The problem is, that the latest artifactId in the jar publications will be set for all subprojects.

How can I create a configuration which only maps to one single jar?

subprojects {

apply plugin: ‘java’

task implJar(type: Jar, dependsOn: classes ) {
baseName project.name
classifier = project.name
from sourceSets.main.output
version scmVersion.version
}
publishing {
publications {
// TODO do this for every module -> it will only be done once
jar(MavenPublication) {
artifactId project.name // Problem: This will only be set and reset for every project. That’s why this overwrites the configurations made before
groupId "com.portal"
artifact implJar
}
}
}

}

Maybe related to:


EDIT: Made example easier and hope to get a hint :slight_smile:


(Jan Rodan) #2

The main question is: How can I create a publication for each submodule which will not be overwritten by configrurations made for the next project.

Is it possible to use the project.name as publications name?