Gradle Multiproject构建依赖项:包不存在

时间:2014-02-10 15:30:26

标签: build dependencies gradle multi-project

我的项目结构

Main_Project/  
--build.gradle  
--settings.gradle  
--com.project.core/  
----build.gradle  
--com.project.core.test/  
----build.gradle <--this requires classes defined in ProjectCore

ProjectTest build.gradle的依赖项:

dependencies {
    compile project(':com.project.core')
    testCompile "junit:junit:4"
    runtime files('C:/eclipse/plugins/org.hamcrest.core_1.3.0.v201303031735.jar')
}

这是我的settings.gradle:

include 'com.project.core',
    'com.project.core.test'    

报告错误消息:

H:\ gitwork \ com.project.core.test \ src \ com \ project \ common \ providable \ sortedprovidablemanagertest \ SimpleObject.java:8:error:  包com.project.core.providable.abstractions不存在 import com.project.core.providable.abstractions.AProvidable;

1 个答案:

答案 0 :(得分:1)

如果要使用与相应目录名称不同的项目名称,则必须单独配置后者:

include 'com.project.core'
include 'com.project.core.test'

project(':com.project.core').projectDir = 'ProjectCore'
project(':com.project.core.test').projectDir = 'ProjectTest'