开发者

Using a project as a compile time dependency without including it's compile time dependencies?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜