Ошибка при компиляции Gradle проекта

Компилирую Gradle проект. При построении вылезает ошибка: java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module @0x4e186428) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module @0x4e186428.

Пробовал менять версию Gradle. Менял на 7.0, эта ошибка ушла вместо неё пришли куча других ошибок связанных с gradle кодом. Добавлял в код аргументы:

tasks.withType( JavaCompile ).configureEach {
    options.forkOptions.jvmArgs.addAll( ['--add-opens', 'jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED'] )
}

Версия Java: 1.8 Версия Gradle: 6.8 Scan: https://gradle.com/s/anpo5psl4hcpo

build.gradle:

plugins {
    id 'java'
    id 'application'
}

mainClassName = "ru.hastg9.main.Main"

group 'ru.hastg9'
version '1.0'




    repositories {
        mavenCentral() // for transitive dependencies
        mavenLocal()
        jcenter()
        maven {
            name 'm2-dv8tion'
            url 'https://m2.dv8tion.net/releases'
        }
    }

    dependencies {
        implementation 'net.dv8tion:JDA:4.2.0_224'
        implementation 'net.sf.trove4j:trove4j:3.0.3'
        implementation 'com.fasterxml.jackson.core:jackson-annotations:2.10.1'
        implementation 'com.fasterxml.jackson.core:jackson-core:2.10.1'
        implementation 'com.fasterxml.jackson.core:jackson-databind:2.10.1'
        implementation group: 'org.bytedeco', name: 'javacv-platform', version: '1.5.5'
        compile fileTree(dir: 'libs', include: ['JDA-4.2.0_224.jar'])
        compile fileTree(dir: 'libs', include: ['trove4j-3.0.3.jar'])
        compile fileTree(dir: 'libs', include: ['jackson-annotations-2.10.1.jar'])
        compile fileTree(dir: 'libs', include: ['jackson-core-2.10.1.jar'])
        compile fileTree(dir: 'libs', include: ['jackson-databind-2.10.1.jar'])
        compile group: 'org.bytedeco', name: 'javacv-platform', version: '1.5.5'
    }

tasks.withType( JavaCompile ).configureEach {
    options.forkOptions.jvmArgs.addAll( ['--add-opens', 'jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED'] )
}

test {
    useJUnitPlatform()
}

jar {
    manifest {
        attributes 'Main-Class': mainClassName
    }
    from configurations.compileClasspath.findAll {!it.path.endsWith(".pom") }.collect { it.isDirectory() ? it : zipTree(it) }

}


Ответы (0 шт):