如何修复“任务‘compileJava’执行失败”错误。

好的,我正在 Intellij Idea 中使用 JDA 编写 Discord 机器人,并且使用 botCommons 进行嵌入。使用 Gradle 并导入 botCommons jar 文件。那是成功的。然而。我尝试启动机器人并在控制台中遇到此问题:


Execution failed for task ':compileJava'.

> Could not resolve all files for configuration ':compileClasspath'.

   > Could not find com.afollestad:ason:1.4.16.

     Searched in the following locations:

       - https://jcenter.bintray.com/com/afollestad/ason/1.4.16/ason-1.4.16.pom

       - https://jcenter.bintray.com/com/afollestad/ason/1.4.16/ason-1.4.16.jar

       - https://repo.maven.apache.org/maven2/com/afollestad/ason/1.4.16/ason-1.4.16.pom

       - https://repo.maven.apache.org/maven2/com/afollestad/ason/1.4.16/ason-1.4.16.jar

       - https://jitpack.io/com/afollestad/ason/1.4.16/ason-1.4.16.pom

       - https://jitpack.io/com/afollestad/ason/1.4.16/ason-1.4.16.jar

     Required by:

         project :

         project : > com.github.duncte123:botCommons:fbb8f98

我有我的 build.gradle 文件:


plugins {

    id'java'

    id'application'

    id'com.github.johnrengelman.shadow' version '2.0.4'

}


mainClassName = 'me.ntmnathan.RoryMercury.Main'


version '1.0'


sourceCompatibility = 1.8


repositories {

    jcenter()

    mavenCentral()


    maven { url 'https://jitpack.io' }

}


dependencies {

    compile group: 'net.dv8tion', name: 'JDA', version: '3.8.0_434'

    compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'

    compile group: 'com.github.duncte123', name: 'botCommons', version: 'fbb8f98'

    compile group: 'com.afollestad', name: 'ason', version: '1.4.16'


}


compileJava.options.encoding = 'UTF-8'

抱歉,我对 Java Discord 机器人开发有点陌生,但如果有任何帮助,我们将不胜感激。


ABOUTYOU
浏览 62回答 2
2回答

慕村225694

com.afollestad:ason:1.4.16位于:https://repo.spring.io/libs-release/com/afollestad/ason/1.4.16/您需要在repositories列表中再添加一个存储库:maven { url 'https://repo.spring.io/libs-release' }下一次,这个答案是由以下人找到的:谷歌com.afollestad:ason:1.4.16单击com.afollestad » ason » 1.4.16 - Maven Repository搜索结果链接阅读注释:注意:这个工件位于 Spring Lib Release 存储库(https://repo.spring.io/libs-release/)

至尊宝的传说

好的:您的 Gradle 构建失败,因为它找不到此依赖项:compile group: 'com.afollestad', name: 'ason', version: '1.4.16'谷歌快速搜索证实它似乎可以在 MavenRepository 上使用:https://mvnrepository.com/artifact/com.afollestad/ason/1.4.6但同一个链接显示您需要将其添加到您的 build.gradle 中:注意:这个工件位于 Spring Plugins 存储库(https://repo.spring.io/plugins-release/)所以改变这个:repositories {   jcenter()   mavenCentral()   maven {      url 'https://jitpack.io'   }   maven {      url 'https://repo.spring.io/plugins-release/'   }
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java