Tag: gradle

将kotlin库(不是Android)发布到jCenter

我有Intellij Idea 2016.1 gradle-application(不是Android)写在Kotlin。 我需要将它放在jCenter中,并作为依赖项添加到Android应用程序中。 我找不到任何有关它的信息。 所有引用都涉及Android项目。 我不知道如何做到这一点。 寻找详细的说明

没有IDE协助的Kotlin为Gradle设置 – Kotlin类没有使它成为classpath

我正在尝试自己创建一个使用Gradle的Java子模块。 我遵循http://kotlinlang.org/docs/reference/using-gradle.html#using-Gradle中的步骤,尽管在不同的Gradle文件中分割了一些东西,IDE似乎正确地识别了一切,Kotlin源码不把它放到classpath中。 在https://github.com/stoyicker/master-slave-clean-store/tree/792c8207776846b0320c1e055521a288c9e63b5a你可以看到失败的快照。

gradle multi-project:构建目录出现在包含Kotlin artefact的根目录中

我们的多项目构建具有以下结构: root-project \-project1 \-project2 \-build.gradle \-settings.gradle 当我从root-project目录运行gradle build ,project1(不是Kotlin项目)中的构建gradle build仍然保留在project1 / build目录下。 但是,构建目录显示在仅包含build/kotlin和build/kotlin-build目录的根目录下。 即使我从root-project/project2运行gradle build ,我也看到了相同的行为。 我错过了什么命令迫使所有的kotlin构建文物被置于: root-dir/project2/build 我在我的root-dir/build.gradle有以下内容,这可能会揭示一些行为: 任务根项目(dependsOn:':project1:build'){ doLast { 复制{ 从项目(':project1:')。文件('dist') (':project2:')。file('build / resources / main / static /') } } } 项目(':project1'){ 任务UI(dependsOn:':project1:runAll'){ doLast { println'UI' } } } 项目(':project2'){ 任务API(dependsOn:':project2:bootRun'){ doLast { println'API' } } }

Android从Gradle和Kotlin的各种错误

Gradle和Kotlin是怎么回事? 我还没有开始编码,并已经后悔回到Android 🙁 Gradle项目 buildscript { ext.kotlin_version = '1.1.3-2' repositories { jcenter() mavenCentral() maven { url 'https://maven.google.com' } } dependencies { classpath 'com.android.tools.build:gradle:2.3.3' classpath 'com.google.gms:google-services:3.1.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version" } } allprojects { repositories { jcenter() maven { url 'https://maven.google.com' } mavenCentral() } } task clean(type: Delete) { delete rootProject.buildDir } Gradle模块 apply plugin: 'com.android.application' […]

使用kotlin-spring插件,还是得不到类的打开错误

尽管添加了kotlin-spring插件,我正在获得一个不能最终决定的类,需要开放。 插件的全部目的是不为每个类手动添加open关键字。 请指导我让Kotling-Spring插件使用下面的代码。 的build.gradle buildscript { ext.kotlin_version = "1.1.2" repositories { mavenCentral() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-noarg:$kotlin_version" } } apply plugin: "kotlin" apply plugin: "kotlin-spring" apply plugin: "kotlin-noarg" apply plugin: "idea" repositories { mavenCentral() } dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version" compile"org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" compile "org.springframework:spring-context:4.3.8.RELEASE" testCompile "org.springframework:spring-test:4.3.8.RELEASE" testCompile "junit:junit:4.11" } AppConfig.java @Configuration class AppConfig […]

在Kotlin脚本中用扩展方法问题

我正在尝试用于Gradle配置的Kotlin脚本。 从build.gradle.kts : val deployTest = System.getProperty("deployTest").toBoolean() 运行: gradle clean build 它适用于我的本地工作站,但在TeamCity上失败: IllegalStateException: Error type encountered: [ERROR : Type for (System.getProperty("deployTest") as String).toBoolean()] (DeferredType) 属性deployTest没有在我的工作站或TC上设置。 而在我的工作站上,它返回false 。 它出什么问题了?

执行失败的任务'应用程序:copyDebugAndroidTestKotlinClasses' – Android的Kotlin生成错误

我试图与Kotlin建立一个两个模块项目,我遇到了这个构建错误,但我不知道如何解决它在一丝丝毫。 Error:Execution failed for task ':app:copyDebugAndroidTestKotlinClasses'. > kotlin.KotlinNullPointerException (no error message) 我的项目build.gradle如下所示: buildscript { ext.compileSdkVersion = 25 ext.buildToolsVersion = "25.0.2" ext.minSdkVersion = 16 ext.targetSdkVersion = 25 ext.kotlin_version = '1.1.0' ext.supportLibVersion = '25.3.1' repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.3.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in […]

Kotlin测试失败从命令行与ClassNotFoundException但从IntelliJ工作

我在这里有一个Kotlin Spring Boot项目。 它有一些测试,从IntelliJ运行得很好,但是当我从命令行运行,失败,出现以下错误。 BUILD FAILED in 1m 12s 7 actionable tasks: 7 executed asarkar:license-report-kotlin$ ./gradlew clean test > Task :compileKotlin Using kotlin incremental compilation > Task :compileTestKotlin Using kotlin incremental compilation > Task :test 2017-07-16 21:43:06.345 INFO 2956 — [ Thread-13] scaAnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@54fa5525: startup date [Sun Jul 16 21:42:04 PDT 2017]; root […]

这个groovy语法如何转换成kotlin?

我在Kotlin创建了一个简单的Greeting任务。 就像Gradle 文档中的一样 。 现在我添加一个简单的测试,看起来像这个在groovy: class GreetingTaskTest { @Test public void canAddTaskToProject() { Project project = ProjectBuilder.builder().build() def task = project.task('greeting', type: GreetingTask) assertTrue(task instanceof GreetingTask) } } 我把这个翻译成了Kotlin,除了这一行中的一个单词: def task = project.task('greeting', type: GreetingTask) 有问题的位是第二个参数。 键入:GreetingTask 它究竟代表什么,它如何转化为科特林?

如何在使用Gradle的AppEngine项目中使用Kotlin

就像标题所说的那样,在开发AppEngine项目时如何使用Kotlin? 我使用IntelliJ / Android Studio与Gradle作为我的构建工具。