【发布时间】:2016-04-21 16:53:34
【问题描述】:
我正在开发一个应用程序,我想将 Android 特定逻辑与业务逻辑(“不可变”逻辑和 Android 独立)分开,所以我创建了两个模块:
- app:Android 特定代码
- 域:业务逻辑(用 Kotlin 编写)
我将这个 build.gradle 文件用于 kotlin 模块
apply plugin: 'kotlin'
kapt {
generateStubs = true
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
/* Annotations library */
provided 'org.glassfish:javax.annotation:10.0-b28'
kapt 'com.google.dagger:dagger-compiler:2.0.1'
/* Dagger 2 library */
compile 'com.google.dagger:dagger:2.0.1'
/* EventBus library */
compile 'de.greenrobot:eventbus:2.4.0'
/* JODA TIME - time and date library */
compile 'joda-time:joda-time:2.9.2'
/*Rx Kotlin*/
compile 'io.reactivex:rxkotlin:0.55.0'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:2.0.47-beta'
}
buildscript {
ext.kotlin_version = '1.0.1-2'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
repositories {
mavenCentral()
maven{ url "http://repository.jetbrains.com/all" }
}
这是配置 kotlin 模块的正确方法吗?
PLUS:我收到 Gradle DSL 方法未找到:'provided()' 错误。我该如何解决?
【问题讨论】: