I'm trying to make VSCode work with using a Gradle build file using Java with modules (from Java version 11). The gradle.build compile works just fine, but I cannot make VSCode execute the output compiled Java class files. (It always tries to create its own.)
VSCode version: 1.48.2
System Info: Ubuntu 2020.04
Java Build:
openjdk 11.0.8 2020-07-14
OpenJDK Runtime Environment (build 11.0.8+10-post-Ubuntu-0ubuntu120.04)
OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Ubuntu-0ubuntu120.04, mixed mode, sharing)
build.gradle file:
apply plugin: 'java'
def version = 0.1
sourceSets {
main {
java {
srcDir 'src/easytext/javamodularity/easytext'
}
}
}
module-info.java located at $projectDir/src/easytext/module-info.java
// module easytext {
module easytext.javamodularity.easytext {
requires java.base;
}
Really simple Main.java, located at $projectDir/src/easytext/javamodularity/easytext/Main.java:
//package easytext;
package easytext.javamodularity.easytext;
import java.io.IOException;
public class Main {
public static void main(String[] args) throws IOException {
if (args.length == 0) {
System.out.println("Welcome to EasyText. Please provide a filename as input argument.");
return;
}
}
The gradle file always wants to output to $projectDir/build/, but VScode always wants to run the files in $projectDir/bin/easytext/javamodularity/easytext/Main.class.
I am also getting the VSCode error which I do not understand: "module-info.java is not on the classpath of project EasyText, only syntax errors are reported."
Running the Gradle task 'build' does compile successfully.
I do not have a launch.json file because I am a loss for how to point it to the modulePath? Or is there some sort of magic I'm missing?