gpt4 book ai didi

Gradle:在非 Android 项目上检测到不支持的模块

转载 作者:行者123 更新时间:2023-12-02 13:37:09 24 4
gpt4 key购买 nike

我在我的 gradle 项目中收到此警告/错误:Unsupported Modules Detected: Compilation is not supported for following modules: io.github.dogo-Dogo, Dogo_main, Dogo_test. Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project.

我对 Gradle 并不完全熟悉,我搜索了这样的错误,只是在 Android 环境中找到了这些东西,但我只使用了 Kotlin 和一些库。

buildscript {
ext.kotlin_version = '1.3.11'
ext.ktor_version = '1.0.1'
ext.dokka_version = '0.9.17'

repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.17"
}
}

plugins {
id "org.jetbrains.dokka" version '0.9.17'
}
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'application'
apply plugin: 'maven'


group 'io.github.dogo'
version '1.0-SNAPSHOT'



mainClassName = "io.github.dogo.core.boot.BootKt"

sourceCompatibility = 1.8

repositories {
mavenCentral()
jcenter()
maven {url 'https://jitpack.io'}
maven {
name = 'sponge'
url = 'https://repo.spongepowered.org/maven'
}
}

dependencies {
compile "org.jetbrains.kotlin:kotlin-reflect"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

compile "io.ktor:ktor-server-core:$ktor_version"
compile "io.ktor:ktor-server-netty:$ktor_version"

compile 'net.dv8tion:JDA:3.8.1_447'
compile 'org.mongodb:mongodb-driver:3.6.3'
compile 'org.spongepowered:configurate-json:3.6'
compile 'com.fasterxml.jackson.core:jackson-databind:2.0.1'
compile 'com.mashape.unirest:unirest-java:1.3.1'

compile 'org.slf4j:slf4j-simple:1.6.1'
compile 'org.apache.logging.log4j:log4j-core:2.11.1'
compile 'org.apache.logging.log4j:log4j-api:2.11.1'

compile 'org.jetbrains.kotlin:kotlin-script-runtime:1.3.11'
compile 'org.jetbrains.kotlin:kotlin-script-util:1.3.11'
compile 'org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.11'

implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.1'
}

compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}

jar {
manifest {
attributes 'Main-Class': 'io.github.dogo.core.boot.BootKt'
}
from {
configurations.compile
.findAll { !it.name.endsWith('pom') }
.collect { it.isDirectory() ? it : zipTree(it) }
}
}

dokka {
outputFormat = 'html'
outputDirectory = "$buildDir/docs"
}

那么,我该如何解决这个错误/警告信息?我不确定,但我认为当我添加 Dokka(Kotlin 文档工具)时它开始出现

最佳答案

Intellij IDEA 的建议修复对我有用 - 用于纯 Kotlin 工作(不包括任何 Android 跨界工作):

文件 -> 设置 -> 插件 -> 已安装选项卡 -> 取消选中“Android 支持”

并且日志事件消失了......(h/t Joern Mangels)

https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000404920/comments/360000086479

关于Gradle:在非 Android 项目上检测到不支持的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53926685/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com