How to include .jar file in .war file when it is excluded because of transitive providedCompile

Hi,

I have 2 modules: moduleA requires moduleB for compilation but the moduleA.war file cannot contain the moduleB.jar file. so i used providedCompile, but then encountered a problem: both modules require the springframework integration core external jar. and now it is not included to moduleA.war file, since the providedCompile of moduleB is transitive.

//moduleB
dependencies {
    compile group: 'org.springframework.integration', name: 'spring-integration-core'
}
  //moduleA
dependencies {
    providedCompile project(':moduleB')
    compile group: 'org.springframework.integration', name: 'spring-integration-core'
}

i tried using

dependencies {
    providedCompile (project(':moduleB')) {
         transitive = false
    }
           compile group: 'org.springframework.integration', name: 'spring-integration-core'
}

and it is not working