Tag: gradle

什么是Kotlin Gradle依赖关系中的“实现”?

我正在使用Android Studio 3.0 Preview来启动新的Kotlin项目。 当我尝试在build.gradle添加依赖项时,我看到了implementation范围,而不是通常的compile 。 androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) implementation 'com.android.support:appcompat-v7:25.3.1' testImplementation 'junit:junit:4.12' 还有androidTestImplementation和testImplementation作用域。 最后,我添加compile添加第三方依赖关系,它的工作原理。 compile 'io.reactivex.rxjava2:rxandroid:2.0.1' 所以我的问题是.. 什么是implementation , androidTestImplementation和testImplementation范围? 它与compile ,测试compile和androidTestCompile有什么不同吗? 我应该为我的Kotlin项目使用哪一个? 编辑:我的不好,这个问题不是Kotlin特定的。 这是新的Android Gradle插件配置 。

gradle无法使用kotlin类编译java类

我有一个包含“projectA”的gradle 4.1多项目,其中包含2个子文件夹“api”和“implementation”。 多项目使用在主build.gradle的子项目部分中定义的kotlin和java-library插件。 实现项目将API依赖项设置为:projectA:api 在api文件夹中,我在'src / main / java'里有kotlin和java文件,在实现项目中,我正在从API创建一个kotlin类的新实例。 在Intellij Idea里面,我没有任何编译错误; 但是当我编译整个项目使用gradle我有一个error: cannot find symbol 。 就好像compileJava不能访问文件夹kotlin-classes 。 在build/kotlin-classes ,我看到了我的file.class类文件也在build / classes目录下 错误的详细信息: 任务:projectA:api:compileKotlin使用kotlin增量编译 任务:projectA:执行:compileJava(…)错误:找不到符号(导入失败) 更新1 :删除Java库解决了我的问题

Gradle同步失败:无法GET'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.1.3-2/kotlin-gradle-plugin-1.1.3-2.pom'

最近,我更新了我的团队的代码,我发现他们一直在使用Kotlin。 但是,我现在无法运行我的项目。 以下是详细的日志: 无法解析配置':classpath'的所有依赖关系。 无法解析org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.3-2。 必需:project:无法解析org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.3-2。 无法获取资源“ https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.1.3-2/kotlin-gradle-plugin-1.1.3-2.pom ”。 无法GET'https: //jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.1.3-2/kotlin-gradle-plugin-1.1.3-2.pom '。 连接到127.0.0.1:8080 [/ 127.0.0.1]失败:连接被拒绝(连接被拒绝)无法解析org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.3-2。 无法获取资源“ https://dl.bintray.com/andreid/maven/org/jetbrains/kotlin/kotlin-gradle-plugin/1.1.3-2/kotlin-gradle-plugin-1.1.3-2.pom ”。 无法GET'https: //dl.bintray.com/andreid/maven/org/jetbrains/kotlin/kotlin-gradle-plugin/1.1.3-2/kotlin-gradle-plugin-1.1.3-2.pom ' 。 连接到127.0.0.1:8080 [/127.0.0.1]失败:连接被拒绝(连接被拒绝) UDPATE: 我刚刚从浏览器下载了“kotlin-gradle-plugin-1.1.3-2.pom”文件,请告诉我该复制这个文件到哪个目录?

没有找到使用Gradle插件的Kotlin编译器

我试图从Kotlin 1.0.6升级一些Gradle项目到最新版本(1.1.0)。 但是,只要达到compileKotlin任务,它就会失败: :kiwi-common-kotlin:compileKotlin FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':kiwi-common-kotlin:compileKotlin'. > Could not find Kotlin Compiler jar. Please specify compileKotlin.compilerJarFile * Try: Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output. BUILD FAILED 这个项目本身被分成了一些子项目。 […]

不能使用Gradle和Kotlin编译项目

在从1.1.4-3到1.1.50(或51)碰撞kotlin-gradle-plugin之后,以及所有与Kotlin相关的库,在尝试导入gradle文件时遇到类似下面的错误: Unable to build Kotlin project configuration Details: java.lang.reflect.InvocationTargetException: null Caused by: java.lang.NoSuchMethodError: kotlin.reflect.jvm.internal.KClassImpl.getData()Lkotlin/reflect/jvm/internal/ReflectProperties$LazyVal; 使用较旧版本的插件(1.1.4-3)时,编译工作正常。 完整的gradle文件: apply plugin: 'war' apply plugin: 'com.google.cloud.tools.appengine' apply plugin: 'kotlin' apply plugin: 'kotlin-kapt' apply plugin: "net.ltgt.apt" apply plugin: 'idea' apply plugin: 'org.jetbrains.dokka' def daggerVersion = "2.11" sourceCompatibility = '1.8' targetCompatibility = '1.8' buildscript { repositories { mavenCentral() maven { url […]

Android Studio 3.0 + Kotlin两个Gradle守护进程

Android Studio 3.0(Beta 7)在使用Java + Kotlin编译产品时是否正常运行2个gradle守护程序? 只是建立一个项目而消耗大量的资源 更新10/27/17我已经更新了Android Studio 3.0,但得到两个Gradle Daemon,我认为其他守护进程是Kotlin编译器,因为它说kotlin-compiler-embedabble-1.1.51.jar 。 但为什么它需要有一个单独的过程…

TreeWalker检查不与Kotlin / Gradle一起工作?

我想使用CheckStyle(7.1) (旧版本有相同的问题)运行Gradle(2.14.1)的Kotlin程序。 正常的模块/检查(例如NewlineAtEndOfFile , FileTabCharacter ,…)像魅力一样工作,但TreeWalker (ex AvoidStarImport )的子模块都没有。 gradle test完成了BUILD SUCCESSFUL (并且我200%确定应该有样式错误),并且在build/reports/checkstyle/main.html文件中有xx文件,但是有0个错误。 TreeWalker不能和Kotlin一起工作吗? 我找不到任何有关这方面的信息:/ build.gradle文件中的配置: … apply plugin: 'checkstyle' … checkstyle { toolVersion = "7.1" configFile = new File(rootDir, "checkstyle.xml") checkstyleMain.source = "src/main/kotlin" checkstyleMain.ignoreFailures = false checkstyleMain.showViolations = true } …

为什么intelliJ IDEA依赖范围是“提供”而不是“编译”?

我希望IntelliJ IDEA将我的库作为“编译”范围而不是“提供”范围。 这是我的gradle文件的一部分: apply plugin: 'java' sourceCompatibility = 1.8 repositories { mavenCentral() } dependencies { // Logging compile 'ch.qos.logback:logback-classic:1.2.1' compile 'com.getsentry.raven:raven-logback:7.8.2' // BigQuery compile 'com.google.api-client:google-api-client:1.20.0' compile 'com.google.apis:google-api-services-bigquery:v2-rev227-1.20.0' // Configuration management compile 'commons-configuration:commons-configuration:1.10' //Json compile 'org.json:json:20160810' //Kafka compile "org.apache.kafka:kafka-clients:0.10.1.1" testCompile group: 'junit', name: 'junit', version: '4.12' testCompile 'org.assertj:assertj-core:3.0.0' testCompile 'org.mockito:mockito-all:1.10.19' } task wrapper(type: Wrapper) { gradleVersion […]

获取IntelliJ Kotlin插件和gradle匹配

我正在尝试IntelliJ 16,早期访问版本,但我的项目不会编译: Error:(16, 17) Kotlin: Unresolved reference: substring (note: this may be caused by the fact that some classes compiled with an incompatible version of Kotlin were found in the classpath. Such classes cannot be loaded properly by this version of Kotlin compiler. 据推测,Kotlin的Gradle和IntelliJ版本需要匹配,但安装的Kotlin插件是: 1.0.0-rc-1007-IJ143-11 我没有看到这在任何公共存储库。 我在Gradle项目中宣布的最新版本是: buildscript { ext.kotlin_version = ' 1.0.0-rc-1007-IJ143-11' 。 。 […]

Kotlin接口导出到Javascript缺少的属性

我在Kotlin中有一个简单的界面,如下所示: interface IMyInterface { var name: String var description: String } 用这样的build.gradle文件: apply plugin: 'java' apply plugin: 'kotlin2js' sourceCompatibility = 1.8 repositories { mavenCentral() } dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } compileKotlin2Js { kotlinOptions.moduleKind = "umd" kotlinOptions.sourceMap = true } 它在我输出的时候输出这个javascript: (function (root, factory) { if (typeof define === 'function' && define.amd) define(['exports', 'kotlin'], […]