From the gradle maven-publish plugin\'s documentation, it\'s clear that you set the groupId and version of the project directly in build.gradle>
If you have a multi-module project, and you want the artifacts' names to differ from the Directory (which is set in the settings.gradle), then I think a better approach is to have a jar block for each sub-project, and there you can write the baseName, which will be the artifact-id. Then, rather than re-writing the publishing/publications block for each sub-project, you write it only once in the main build.gradle this way:
for each sub-project build.gradle:
jar {
baseName = 'new-artifact-name-A' //A beacause you also have B, C modules...
}
in the main build.gradle:
publishing {
publications {
mavenJava(MavenPublication) {
artifactId jar.baseName
from components.java
}
}
}