build.gradle
How to enable Java 12 preview features with Gradle?
You need to configure the JavaCompile tasks, so that Gradle passes this option to the Java compiler when compiling. Something like this should work: tasks.withType(JavaCompile).each { it.options.compilerArgs.add(‘–enable-preview’) } To run the app/tests we need to add jvmArgs. Example: test { jvmArgs([‘–enable-preview’]) }
Gradle7 Version Catalog: How to use it with buildSrc?
With Gradle 7.3.3, it is possible. Note version catalogs are GA since Gradle 7.4 The code snippet assumes Gradle is at least 7.4, but if you need them prior that version, insert enableFeaturePreview(“VERSION_CATALOGS”) at the beginning of each settings.gradle.kts. Using buildSrc buildSrc/settings.gradle.kts dependencyResolutionManagement { versionCatalogs { create(“libs”) { from(files(“../gradle/libs.versions.toml”)) } } } buildSrc/build.gradle.kts dependencies { … Read more
Execution failed for task ‘:compileJava’. > invalid source release: 1.7
You can set the JDK Version used by gradle for the build by adding a “gradle.properties” file to your project. Add the following property: org.gradle.java.home = <Path to the JDK you want to use for your project> I agree with the previous answer that you also should check if the JDK and the sourceCompatibility match.
Gradle – add directory to classpath
The application plugin documentation says: Static files to be added to the distribution can be simply added to src/dist I would try putting your config directory into src/dist/lib and continue adding it to your classpath with runtime files(‘src/dist/lib/config’) Note: working around this defect means that config has to go into /lib under src/dist