I have a multi-module project as follow:
top-level-module
sub-module-1
sub-module-2
sub-module-3
Top level module gradle config looks like this:
...
def javaProjects() {
subprojects.findAll { new File(it.projectDir, 'src/main/java').directory }
}
configure(javaProjects()) {
apply plugin: "io.franzbecker.gradle-lombok"
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: "jacoco"
apply plugin: 'maven'
apply plugin: 'maven-publish'
...
publishing {
repositories {
maven {
url = ...
credentials {
username = ...
password = ...
}
}
}
}
}
sub-module-1 and sub-module-2 have a gradle config like this:
plugins {
id 'java'
id 'groovy'
id 'application'
id 'maven'
id 'maven-publish'
}
mainClassName = 'com.mycompany.MyClass'
applicationName = 'xxx-cli' // xxx-cli is different for both modules
...
publishing {
publications {
XXXCliTar(MavenPublication) { // XXXCliTar is different in two modules
artifact(distTar)
artifactId "${applicationName}"
}
}
}
When I use the publish task as follows:
gradle -i build publish
I find that only the artifacts from sub-module1 is published.
What is really odd about this is that this only happens when run in Jenkis job (on a linux slave). It dos not happen when run on my windows dev machine!
I am wondering why artifacts from sub-module2 is not published.