Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
10.0.0-M1
-
None
Description
In Wicket 10, the wicket-core and wicket-util jars contain JUnit-related code, see class list below.
The problem:
- When creating a new modular (JPMS) maven project by adding __ just org.apache.wicket.commons.fileupload (not containing JUnit code) in module-info, projects run fine in Eclipse IDE (2023-06). I supplied a quickstarter at https://github.com/gluser1357/jerseyissues/tree/main-without-junit-code, see readme.txt.
- In contrast, when creating a new modular project by adding org.apache.wicket.util" (containing JUnit code), Eclipse fails in different ways, see wicket quickstarter at https://github.com/gluser1357/jerseyissues/tree/main-with-junit-code-error, see readme.txt.
- If JUnit is kept with usual <scope>test<scope> (pom.xml) and not added via requires org.junit.jupiter.api in module-info.java, one of the following errors occur when running code (see readme.txt for more details):
- java.lang.module.FindException: Module org.junit.jupiter.api not found, required by org.apache.wicket.util
- java.lang.Error: Unresolved compilation problem: "The type org.junit.jupiter.api.Test is not accessible"
- java.lang.IllegalAccessError: class org.junit.platform.launcher.core.ServiceLoaderRegistry (in unnamed module @0x5f341870) cannot access class org.junit.platform.commons.logging.LoggerFactory (in module org.junit.platform.commons) because module org.junit.platform.commons does not export org.junit.platform.commons.logging to unnamed module @0x5f341870
- After correcting the missing module and dependency by removing <scope>test<scope> (pom.xml) and adding a requires org.junit.jupiter.api in module-info.java (which is, as far as I know, actually untypical), own code in /src/test/java and /src/main/java runs now, but own JUnit tests can still not be executed via "Run As JUnit Test" in Eclipse because of
- java.lang.IllegalAccessError: class org.junit.platform.launcher.core.ServiceLoaderRegistry (in unnamed module @0x5f341870) cannot access class org.junit.platform.commons.logging.LoggerFactory (in module org.junit.platform.commons) because module org.junit.platform.commons does not export org.junit.platform.commons.logging to unnamed module @0x5f341870
- If JUnit is kept with usual <scope>test<scope> (pom.xml) and not added via requires org.junit.jupiter.api in module-info.java, one of the following errors occur when running code (see readme.txt for more details):
In my opinion, the JUnit-related code below shouldn't be contained in /src/main/java which is a) quite untypical and b) results in problems of common IDEs like Eclipse.
Would it be possible to
- move the related Wicket classes (see list below) out of /src/main/java, e. g. to /src/test/java and
- remove requires org.junit.jupiter.api from both module-info?
This would avoid these problems in Eclipse IDE for JPMS-based projects that want to integrate Wicket.
=====
The relevant classes are:
- in wicket-util:
- in wicket-core:
- https://github.com/apache/wicket/blob/rel/wicket-10.0.0-M1/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
- https://github.com/apache/wicket/blob/rel/wicket-10.0.0-M1/wicket-core/src/main/java/org/apache/wicket/util/tester/DiffUtil.java
- https://github.com/apache/wicket/blob/rel/wicket-10.0.0-M1/wicket-core/src/main/java/org/apache/wicket/util/tester/FormTester.java
- https://github.com/apache/wicket/blob/rel/wicket-10.0.0-M1/wicket-core/src/main/java/org/apache/wicket/util/tester/WicketTestCase.java
- https://github.com/apache/wicket/blob/rel/wicket-10.0.0-M1/wicket-core/src/main/java/org/apache/wicket/util/tester/WicketTester.java
- https://github.com/apache/wicket/blob/rel/wicket-10.0.0-M1/wicket-core/src/main/java/org/apache/wicket/util/tester/WicketTesterExtension.java
- https://github.com/apache/wicket/blob/rel/wicket-10.0.0-M1/wicket-core/src/main/java/org/apache/wicket/util/tester/WicketTesterHelper.java
Attachments
Attachments
Issue Links
- is a parent of
-
WICKET-7079 Update the user guide with the new wicket-tester module
- Resolved
- relates to
-
WICKET-7019 [Not an Issue] Remove Junit Jupiter from module path (JPMS)
- Resolved
- links to