Repository navigation
Modularization
The EVL library follows the Java 9 modules recommendations. Here is the current status.
Apache Maven: 3.6.2
Java version: 16.0.1, vendor: Oracle Corporation
Eclipse version: 2021-06 (4.20.0)
The library has a single module-info.java in src/main/java. It simply exports all the necessary packages to use EVL.
Following recommendations from Maven Surefire, we tried to define a module-info.java in src/test/java containing:
open module eu.daproject.evl.tests {
requires eu.daproject.evl;
requires transitive org.junit.jupiter.engine;
requires transitive org.junit.jupiter.api;
}
However it leads to a failure in our two compilation environments:
- Error in Maven command line: the package org.junit is not visible.
- Error in Eclipse: module-info.java is seen twice at the same place causing a compilation error.
We are waiting for improvements or new recommendations as the unit tests work well without modularization.
To test the EVL module we defined a simple project containing a single module defining a main class:
package testmodule;
import eu.daproject.evl.Cases;
import eu.daproject.evl.Method1;
import eu.daproject.evl.exception.InvocationException;
public class TestModule {
public void foo(Integer i) {
System.out.println("Foo " + i);
}
public static void foos(Float f) {
System.out.println("Foos " + f);
}
public static void main(String[] args) throws Throwable {
System.out.println("Testing EVL module");
Method1<Void> m = new Method1<Void>();
TestModule tm = new TestModule();
m.add(tm, "foo");
m.add(TestModule.class, "foos");
m.add(new Cases() {
void match(Double d) {
System.out.println("I am the double " + d);
}
void match(String s) {
System.out.println("I am the string " + s);
}
});
try {
m.invoke(Integer.valueOf(11));
}
catch (InvocationException e) {
}
}
}
The module-info.java contains:
module testmodule {
requires eu.daproject.evl;
}
Here are the results:
- Maven command line compiles and executes the code as expected.
- Eclipse compiles the code but does not execute properly: The reflection does not work, the methods from TestModule are not accessible from the MultiMethod class. Removing the module-info.java makes the execution succeed.
We tried to generate an executable using jpackage on Windows. We first tried to generate the simplest application that only prints a string. We used the following command line:
$ jpackage --type app-image --verbose --input input --dest output --name testmodule --main-jar evl-test-module-0.0.1-SNAPSHOT.jar --main-class testmodule.TestModule
There is no error at the package creation and no error at runtime, however there is nothing printed. We are waiting for more information on how to use jpackage.
The EVL wiki