I have two Gradle projects, project A which is a war and project B which is a jar. Project A depends on project B. Project B has a compile dependency C. When I build project B the compile dependency C is not included in the generated jar which is what I expect. When I build project A project B is included in the lib directory of my war along with compile dependency C.
What I want is the output of the jar task for project B to be included in the lib directory of my war file, how can I do this? I've pasted the relevant fragments of my Gradle build file below.
project A
apply plugin: 'war开发者_高级运维'
dependencies {
compile project(':B')
}
project B
apply plugin: 'java'
dependencies {
compile (group: 'org.apache.openejb', name: 'C', version: '5.0-3')
}
Inside project A you can use providedCompile configuration to exclude some of the transitive dependecies from being included in WAR:
dependencies {
compile project(':B')
providedCompile (group: 'org.apache.openejb', name: 'C', version: '5.0-3')
}
You can read more about it in WAR plugin documentation.
精彩评论