Hello,
I have a multi-project gradle build, like bellow.
+-- rootproject
| +-- subproject1
| | +-- src
| | \-- build.gradle (1)
| | \-- settings.gradle (1)
| |
| +-- subproject2
| | +-- src
| | \-- build.gradle (2)
| | \-- settings.gradle (2)
| |
| +-- subproject3
| | +-- src
| | \-- build.gradle (3)
| | \-- settings.gradle (3)
| |
| \-- build.gradle (root)
| \-- settings.gradle (root)
In my root ‘build.gradle’ I have define a common way for maven publication:
subprojects {
...
version = "1.0.0"
group = "com.society.division.department.component"
...
// maven publication
apply plugin: 'maven-publish'
publishing {
repositories {
maven{
credentials {
username "${own_artifactory_username}"
password "${own_artifactory_password}"
}
url "${own_artifactory_server}${own_artifactory_release_repository}"
}
}
publications {
maven(MavenPublication) {
artifact (jarApi){
artifactId "comp_${project.name}"
classifier "api"
extension 'jar'
}
artifact (project.tasks.jar){
artifactId "comp_${project.name}"
extension 'jar'
}
artifact (project.tasks.jarStub){
artifactId "comp_${project.name}"
classifier "stub"
extension 'jar'
}
artifact (project.tasks.jarTest){
artifactId "comp_${project.name}"
classifier "test"
extension 'jar'
}
pom.withXml {
asNode().appendNode('name', "${project.name}")
asNode().appendNode('description', "${description}")
}
}
}
}
...
}
When i call gradle publish task, the publication work fine but the destination path is.
+-- maven_repository
| +-- com
| | +-- society
| | | +-- division
| | | | +-- department
| | | | | +-- component
| | | | | | +-- comp_subproject1
| | | | | | | +-- 1.0.0
| | | | | | | \-- comp_subproject1-1.0.0.jar
| | | | | | | \-- comp_subproject1-1.0.0-api.jar
| | | | | | | \-- comp_subproject1-1.0.0-stub.jar
| | | | | | | \-- comp_subproject1-1.0.0-test.jar
| | | | | | | \-- comp_subproject1-1.0.0.pom
| | | | | | |
| | | | | | +-- comp_subproject2
| | | | | | | +-- 1.0.0
| | | | | | | \-- comp_subproject2-1.0.0.jar
| | | | | | | \-- comp_subproject2-1.0.0-api.jar
| | | | | | | \-- comp_subproject2-1.0.0-stub.jar
| | | | | | | \-- comp_subproject2-1.0.0-test.jar
| | | | | | | \-- comp_subproject2-1.0.0.pom
| | | | | | |
| | | | | | +-- comp_subproject3
| | | | | | | +-- 1.0.0
| | | | | | | \-- comp_subproject3-1.0.0.jar
| | | | | | | \-- comp_subproject3-1.0.0-api.jar
| | | | | | | \-- comp_subproject3-1.0.0-stub.jar
| | | | | | | \-- comp_subproject3-1.0.0-test.jar
| | | | | | | \-- comp_subproject3-1.0.0.pom
But I would like to have something like that :
+-- maven_repository
| +-- com
| | +-- society
| | | +-- division
| | | | +-- department
| | | | | +-- component
| | | | | | +-- 1.0.0
| | | | | | | \-- comp_subproject1-1.0.0.jar
| | | | | | | \-- comp_subproject1-1.0.0-api.jar
| | | | | | | \-- comp_subproject1-1.0.0-stub.jar
| | | | | | | \-- comp_subproject1-1.0.0-test.jar
| | | | | | | \-- comp_subproject1-1.0.0.pom
| | | | | | | \-- comp_subproject2-1.0.0.jar
| | | | | | | \-- comp_subproject2-1.0.0-api.jar
| | | | | | | \-- comp_subproject2-1.0.0-stub.jar
| | | | | | | \-- comp_subproject2-1.0.0-test.jar
| | | | | | | \-- comp_subproject2-1.0.0.pom
| | | | | | | \-- comp_subproject3-1.0.0.jar
| | | | | | | \-- comp_subproject3-1.0.0-api.jar
| | | | | | | \-- comp_subproject3-1.0.0-stub.jar
| | | | | | | \-- comp_subproject3-1.0.0-test.jar
| | | | | | | \-- comp_subproject3-1.0.0.pom
How to change the maven publication layout ? to perform this ?
Thank you.