In option 1:
3. Add requires clauses for all packages contained in analytics.jar and ojdbc8.jar that are directly referred to by classes in reports.jar in its module-info.java.
But why? analytics.jar and ojdbc8.jar are automatic modules. So you have to require the two jar files in module-info.java:
requires analytics;
requires ojdbc8;
And later you can import all packages you need inside your report project. No need to require any packages in module-info.java.
Here is another example:
module-info.java
Code: Select all
module automatic {
/* AUTOMATIC MODULE */
/* commons-csv-1.7.jar */
requires commons.csv;
}
Code: Select all
package automatic.main;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVRecord;
import java.io.FileReader;
import java.io.IOException;
public class Main {
public static void main(String[] args) {
try {
var in = new FileReader("countries.csv");
Iterable<CSVRecord> records = CSVFormat.EXCEL.withDelimiter(';')
.withHeader().parse(in);
for (CSVRecord record : records) {
String name = record.get(1);
System.out.println(name);
}
in.close();
} catch (IOException e) {
}
}
}