Subproject + artifacts

(Magno) #1

Hi, I have the following setup

   root
    |- build.gradle
    |- a
        |- build.gradle
    |- b
       |- build.gradle

in subproject b build.gradle, we have

 dependencies {
   compile project (':a')
}
task copyDeps(type: Copy) {
    from configurations.runtime
    into 'build/libs'
}

Now a’s build.gradle produce multiple artifacts:

task HelloJar(type:Jar){
     ...
     from(sourceSets.main.output) {  
           include "com/hello/**" 
           project.ext.serverExcludes.addAll(includes)
           archiveName "hello-${project.version}.jar"
      }  
 }
task HiJar(type:Jar){
    ....
     from(sourceSets.main.output) {  
           include "com/hi/**" 
           project.ext.serverExcludes.addAll(includes)
           archiveName "hi-${project.version}.jar"
      }  
 }
artifacts {
     archives HelloJar, HiJar
}

When I run b:build, it builds successfully, but can’t run its test cases because the classpath by default, only includes a.jar, not any custom defined jar from a and a.jar does not have all the source. Also, running copyDeps won’t include jars from HiJar and HelloJar neither. So how can I include all the jars that’s built by a into b?

Thanks!

0 Likes