1

In a multi project build I can declare a dependency on another build in a subproject build.gradle file as

project compile(':projectA')

which I can translate into the following in a plugin

project.dependencies.add("compile", project.parent.findProject("projectA"))

If I want to specify a configuration on the dependency in the build.gradle I can use

compile project(path: ':projectA', configuration: 'testUtilRuntime')

but I cannot work out how to specify this in a plugin. Please help.

I tried using a DefaultProjectDependencyFactory.create(), amongst other things, but that expects a ProjectInternal and the findProject returns a DefaultProject

4

1 回答 1

0

我认为您的意思是dependencies { compile project(":projectA") },它转换为project.dependencies { compile project.project(":projectA") }(Groovy)插件。第二个片段转换为project.dependencies { compile project(path: ':projectA', configuration: 'testUtilRuntime') }. 这里的 innerproject不需要限定,因为它指的是DependencyHandler#project而不是Project#project.

于 2013-10-11T20:46:39.347 回答