[ https://issues.apache.org/jira/browse/WICKET-7072?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17769080#comment-17769080 ]
Sam Peters commented on WICKET-7072: ------------------------------------ [~mgrigorov]: Thank you for your feedback. I understand your point of view. It's "only" an Eclipse/VSCode problem, not a gradle, maven or Intellij one. As Eclipse developers, we wish that Wicket (that we use a lot because it's a real cool framework) is supported in Eclipse. The current code from master (10.0.0) is not (related to workspace resolution which is the normal, default case). Neither for developing own applications nor for developing Wicket code itself (both in Eclipse and VSCode). We actually do not have problems in Eclipse with frameworks others than Wicket. Likely because of those frameworks neither use test-jar dependencies, nor put JUnit code in src/main/java (I agree that this actually should not be a problem since JUnit is a library as many others. But, it is also different than others in that way that maven tries to separate non-test code on /src/main/java from test code in /src/test/java, so there normally shouldn't be a reason to put JUnit code on /src/main/java). The latter problem can be solved with merging of the current state of #660. Concerning the first (test-jar) problem in this context, I found that we can easily get rid of test-jar, introduced (the first time ever in Wicket?) in the branches relevant for this issue WICKET-7072. Thus, I, as Eclipse developer, _wish to not include test-jars_ for this issue _because I see no need to use it_ (see the suggested changes I listed above). {quote}adding more changes in the same branch will make it even harder to review. {quote} I see. We could break up the changes into following PRs: * #660 (separation from JUnit code from wicket-core /src/main/java, ...) - required for Eclipse (for application development) * new one (revert test-jar from wicket-util) - required for Eclipse (Wicket code development), see suggested changes above * new one (rat-plugin) - replace ApacheLicenseHeaderTestCase by existing plugin (as suggested by [~solomax]) I'd be happy if current state of #660 could be merged after reviews have been finished. For the two new suggested PRs I can support by writing the PRs (based on #660). > JUnit code in /src/main/java breaks JPMS support in Eclipse IDE > --------------------------------------------------------------- > > Key: WICKET-7072 > URL: https://issues.apache.org/jira/browse/WICKET-7072 > Project: Wicket > Issue Type: Bug > Components: wicket-core > Affects Versions: 10.0.0-M1 > Reporter: Sam Peters > Priority: Major > > 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_ > > 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: > ** > [https://github.com/apache/wicket/blob/rel/wicket-10.0.0-M1/wicket-util/src/main/java/org/apache/wicket/util/license/ApacheLicenseHeaderTestCase.java] > ** > [https://github.com/apache/wicket/blob/rel/wicket-10.0.0-M1/wicket-util/src/main/java/org/apache/wicket/util/markup/xhtml/WellFormedXmlTestCase.java] > * 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] > -- This message was sent by Atlassian Jira (v8.20.10#820010)