Solve: “java: package java.sql is not visible” (Maven, Intellij)

  1. Go to src/main/java of the particular module you are trying to compile/build.
  2. Create a file called module-info.java in this location.
  3. Add the following lines to this file
module your-module-name {
    requires java.sql;
}