adding prefixes to libs during gradle maven publishing

681 views Asked by At

I setup the next configuration for multiproject build:

allprojects {
  apply plugin: 'maven-publish'

  repositories {
    mavenCentral()        
  }
}
subprojects {
  apply plugin: 'java'

  sourceCompatibility = 1.8
  targetCompatibility = 1.8

  version = rootProject.version
  group = rootProject.group

  archivesBaseName = "PREFIX-${it.name}"
}

But prefix is applied only to built artifacts and not when i execute publish task. Is there a way to configure publishing with prefix?

1

There are 1 answers

2
Alexander Leshkin On BEST ANSWER

In accordance with "Identity values in the generated POM", next configuration should works:

subprojects { project ->
...
    publishing {
        publications {
            maven(MavenPublication) {
                artifactId "PREFIX-${project.name}"
                from components.java
            }
        }
    }  
}