javagradlediscord4j

Could not compile initialization script


So I made a program on my pc that is connected with a discord API using discord4j. On my pc it works just fint, but if I download the project and use it on my laptop I get a weird error in my MacroTester_main__2.gradle. Now the weird thing is, that the path it has a problem with is correct.

does anybody have any idea how to go about this problem and what the solution would be?
Deleting the cache does not solve this issue.

Run the program, it should just run without issue.

Run environment is Intellij.

Gradle version: gradle-7.5.1

discord4j version: 3.2.3

logBack version: 1.2.12


Solution

  • Found the solution myself. Apparently, it was an issue with my implementation that didn't want to work on my pc. What I did was in my build.gradle added another id called application and a section called application in that section you need to define the main class and from there you can run the application in the gradle menu under tasks and application 'run'

    plugins {
        id 'java'
        id 'application'
        id 'com.github.johnrengelman.shadow' version '8.1.1'
    }
    
    group 'org.example'
    version '1.0-SNAPSHOT'
    
    application {
        mainClass = 'Main'
    }
    
    repositories {
        mavenCentral()
    }
    
    dependencies {
        testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
        testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
        implementation 'com.discord4j:discord4j-core:3.2.3'
        implementation 'ch.qos.logback:logback-classic:1.2.12'
    }
    
    test {
        useJUnitPlatform()
    }
    

    gradle menu 'run'