摇篮巢状多项目,项目编译依赖 [英] Gradle nested multi-projects with project compile dependencies

查看:159
本文介绍了摇篮巢状多项目,项目编译依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个相同的问题,这个摇篮多模块项目设置但我必须使用项目编译依赖关系构建和不能使用的库被赋予作为上述问题的解决方案(JAR)依赖的解决方案。

I have an identical problem to this Gradle Multi-Module Project Setup but I have to use project compile dependencies to build and cannot use the library(jar) dependencies solution that was given as a solution in the above question.

Root
|__ P1
|   |_ PP1
|   |_ PP2
|
|__ P2
   |_PP3
   |_PP4

PP1,PP2,PP3和PP4是个子项目,每个都有自己的build.gradle文件; P1和P2还具有的build.gradle和settings.gradle文件。

PP1, PP2, PP3 and PP4 are sub-projects and each have their own build.gradle files; P1 and P2 also have build.gradle and settings.gradle files.

我如何可以声明PP1在PP3的文件的build.gradle编译依赖?

How can I declare PP1 as a compile dependency in PP3's build.gradle file?

apply plugin: 'java' 
dependencies {
    compile('P1:PP1') //does not work
    compile group: 'P1', name: 'PP1', version: '0.1' // jar library dependency not an option

    compile('{ant_target}')? //follow up question - an ant target as a dependency
}

我正在摇篮1.2版

I'm running Gradle v1.2

推荐答案

一个版本只能有一个 settings.gradle 文件。假设 settings.gradle 是在根目录下,包括像这样的项目:

A build can only have a single settings.gradle file. Assuming settings.gradle is in the root directory and includes projects like so:

include "P1:PP1"

您可以添加一个编译依赖,像这样:

You can add a compile dependency like so:

dependencies {
    compile(project(":P1:PP1"))
}

有关详细信息,请参阅摇篮用户指南多工程构建一章。

For more information, see the "Multi-Project Builds" chapter in the Gradle User Guide.

这篇关于摇篮巢状多项目,项目编译依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆