I had a Maven project, which I then switched to Gradle. I am now attempting to compile the Gradle project, but it isn't compiling. For every method, Gradle says that it cannot find the symbol. In my Calendar.java class, here's what it says:
Main instance = Main.getInstance();
^
symbol: method getInstance()
location: class Main
Maven used to compile the project fine, and the method getInstance()
has always existed in the Main class. What can I do to fix this?
For reference, it's a multi-project build. Here's my build.gradle for the mother project:
plugins {
id "java"
id "com.github.johnrengelman.shadow" version "7.1.2"
id "war"
}
group "net.pixlies"
version "1.0-SNAPSHOT"
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
subprojects {
compileJava.options.encoding = "UTF-8"
apply plugin: "java"
apply plugin: "war"
apply plugin: "com.github.johnrengelman.shadow"
}
repositories {
mavenCentral()
maven { url "https://repo.purpurmc.org/snapshots/" }
maven { url "https://repo.extendedclip.com/content/repositories/placeholderapi/" }
maven { url "https://repo.aikar.co/content/groups/aikar/" }
maven { url "https://repo.dmulloy2.net/repository/public/" }
}
dependencies {
implementation "org.mongodb:mongo-java-driver:3.12.11"
implementation "commons-io:commons-io:2.11.0"
implementation "co.aikar:acf-paper:0.5.1-SNAPSHOT"
implementation "org.ocpsoft.prettytime:prettytime:5.0.3.Final"
implementation "commons-lang:commons-lang:2.6"
}
This is the build.gradle of one of my modules, PixliesCore:
plugins {
id 'net.pixlies.java-conventions'
}
dependencies {
implementation 'com.github.stefvanschie.inventoryframework:IF:0.10.7'
implementation 'org.projectlombok:lombok:1.18.24'
implementation 'redis.clients:jedis:4.2.3'
implementation 'joda-time:joda-time:2.11.1'
compileOnly 'org.purpurmc.purpur:purpur-api:1.19-R0.1-SNAPSHOT'
compileOnly 'com.comphenix.protocol:ProtocolLib:4.7.0'
compileOnly 'me.clip:placeholderapi:2.11.2'
}
description = 'PixliesCore'
This is the console output for ./gradlew assemble
> Task :PixliesCore:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':PixliesCore:compileJava'.
> invalid source release: 16
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 11s
11 actionable tasks: 6 executed, 5 up-to-date
I notice that it says "invalid source release: 16," perhaps it is the problem. How would I fix this?