我正在使用Kotlin多平台(JVM & JS),它在IDEA中创建了三个项目:demo、demo-js和demo-jvm。
我想将公共代码分成更多的子项目/子模块。假设我添加了commonmod;如何使其编译?
现在,对于gradle run -p demo-jvm,错误是:
demo/demo-js/src/main/kotlin/demo/commonmod/example.kt: (3, 12): Actual function 'getPlatform' has no corresponding expected declaration
但是我认为我这样做是完
在根build.gradle.kts中应用Quarkus插件的多模块gradle项目在NoSuchElementException的:quarkusBuild步骤失败 > Task :quarkusBuild FAILED
building quarkus jar
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':quarkusBuild'.
> java.util.NoSuchElementException 根build.gradl
当我尝试gradlew build我的项目时,我从compileKotlin任务收到一条错误消息:
F:\IdeaProjects\walp.tinykotlintest>gradlew build
:compileKotlin
...
Only the Kotlin standard library is allowed to use the 'kotlin' package
...
BUILD FAILED
Total time: 6.214 secs
之所以会出现这种情况,是因为我在包中声明了一个类,该包的开头是:kotlin.
是否有一种通过配置我的buil
我使用创建了一个kotlin/gradle项目。正如所述的,如果我试图添加kapt,比如:
plugins {
kotlin("plugin.jpa") version "1.2.71"
id("org.springframework.boot") version "2.1.6.RELEASE"
id("io.spring.dependency-management") version "1.0.7.RELEASE"
kotlin("jvm") ver
我正在尝试构建一个基本的Gradle项目。下面是我的build.gradle文件。我一直收到下面的错误。我不明白是因为你可以在这里找到插件。我想我要去的地方是:
更新:如果我注释掉Kotlin行,spring-boot插件也会发生同样的事情。它不仅仅是Kotlin插件所特有的。
错误:
Error:(21, 0) Plugin [id: 'kotlin', version: '1.1.1'] was not found in any of the following sources:
- Gradle Core Plugins (not a core plug
我尝试在我的Kotlin多平台应用程序中添加Kotlin,但是AndroidSqliteDriver未解决引用。我不明白为什么。我清除缓存并重新生成所有内容,但它也不起作用。
AndroidSqliteDriver:
package com.rompos.deactivator
import com.squareup.sqldelight.android.AndroidSqliteDriver
import android.content.Context
lateinit var appContext: Context
actual fun createDB() : Server {
v
我刚刚使用gradle 3.4和gradle- script -kotlin 0.6将构建脚本转移到了gradle-script-kotlin。
我可以让构建脚本生成一个jar,但是清单中没有包含主类名称。根据我找到的其他帖子,我已经尝试了主类名称,在末尾使用了Kt和KT。
构建脚本如下:
/*
* Copyright 2017 SixRQ Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file excep
我有一个项目,它使用Gradle构建(v6.2.2)。
build.gradle.kts
plugins {
base
java
id("org.springframework.boot") apply false
}
val gradleVersionProperty: String by project
val javaVersion: String by project
val springBootVersion: String by project
val springCloudStarterParentBomVersion: String b
我的构建文件如下所示:
val nexusBaseUri: String by extra
val gradle_version: String by extra
val kotlin_version: String by extra
buildscript {
val nexusBaseUri by extra { "https://mynexusserver/nexus" }
val gradle_version by extra { "4.1" }
val kotlin_version by extra { "1.1.4-
我的build.gradle.kts开头如下:
...
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
...
kotlin("jvm") //target version is java 11
kotlin("plugin.serialization") version "1.6.21"
}
当我试图将kotlin序列化插件更新为最新的时,我会得到以下编译错误:
A problem occurred configuring project
当尝试将Java 17与Kotlin一起使用时,我在尝试运行测试时遇到了以下问题。看来测试类是用Java 17编译的,但是Gradle试图用Java 11运行这些类。这个项目很简单,它是使用生成的。
org.gradle.api.internal.tasks.testing.TestSuiteExecutionException: Could not execute test class 'com.test.auth.AuthApplicationTests'.
at org.gradle.api.internal.tasks.testing.SuiteTestClas
生成失败:
thufir@dur:~/NetBeansProjects/kotlin_dsl$
thufir@dur:~/NetBeansProjects/kotlin_dsl$ gradle clean run
> Configure project :
e: /home/thufir/NetBeansProjects/kotlin_dsl/build.gradle.kts:4:12: Unresolved reference: github
FAILURE: Build failed with an exception.
* What went wrong:
A pro
当我试图编译一个用kotlin编写的单元测试时,我得到了以下错误。
Task :app:compileDebugUnitTestKotlin FAILED ...Cannot inline bytecode built with JVM target 1.7 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option
我已尝试在我的应用程序build.gradle中设置android配置的源兼容性
compileOptions {
s