简体   繁体   中英

How do I fix “Execution failed for task 'compileJava'” error. (Using Intellij Idea and Gradle)

Ok, I am coding a Discord Bot with JDA in Intellij Idea and I am using botCommons for Embeds. Using Gradle and Having imported the botCommons jar file. That was successful. However. I have attempted to start up the bot and had this issue in the console:

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

I have my build.gradle file:

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'

Sorry, I am kinda new to Java Discord Bot Development but any help would be appreciated.

com.afollestad:ason:1.4.16 is located at:
https://repo.spring.io/libs-release/com/afollestad/ason/1.4.16/

You need to add one more repository to your repositories list:

maven { url 'https://repo.spring.io/libs-release' }


For next time, this answer was found by:

OK:

  1. Your Gradle build failed because it could not find this dependency:

     compile group: 'com.afollestad', name: 'ason', version: '1.4.16'
  2. A quick google search confirmed that it appears to be available on MavenRepository:

    https://mvnrepository.com/artifact/com.afollestad/ason/1.4.6

  3. But the same link shows that you need to add this to your build.gradle:

Note: this artifact it located at Spring Plugins repository ( https://repo.spring.io/plugins-release/ )

  1. So change this:

     repositories { jcenter() mavenCentral() maven { url 'https://jitpack.io' } maven { url 'https://repo.spring.io/plugins-release/' }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM