LearnLib / learnlib

A free, open-source Java library for automata learning algorithms
https://learnlib.de
Apache License 2.0
200 stars 52 forks source link

Eclipse: errors in imporing packages #128

Open Arwa1986 opened 2 months ago

Arwa1986 commented 2 months ago

Hi, I'm new to LearnLib. I've cloned both AutomataLib and LearnLib, and they both build successfully. However, when I tried to import them to Eclipse (after installing the Maven plugin m2e), I encountered many errors, mostly related to importing packages. I've already tried the ''mvn package'' to rebuild the project, and it builds successfully, but the errors are still the same. I took a look at issues #32 and #44, but nothing changed.

Any idea of what might have gone wrong?

here is a screenshot of the errors: Screenshots error in emport packages

Desktop:

mtf90 commented 2 months ago

Apparently, the m2e-apt plugin (as described in #32) is no longer needed according to its documentation ("m2e-apt functionality is now directly included in m2e 2.x, therefore this m2e-apt entry is no longer compatible with Eclipse 2022-09 and needs to be removed.") so we may need to update the documentation here. However, Eclipse is still pain. I needed to manually enable automatic annotation processing (under Maven -> Annotation Processing) but even then, the Maven Plugin does not seem to correctly resolve scoped dependencies. This means that a lot of test-cases show alleged compiler errors and even running Example1 fails because the (transitive) compile-scoped Mockito Dependency is not resolved correctly.

If it doesn't cause too much trouble, I would probably suggest using IntelliJ instead (which also supports Eclipse keybindings, so it shouldn't be too much of a change).

Arwa1986 commented 2 months ago

Thank you for your quick response. I've downloaded Intellij and imported LearnLib as suggested in the documentation. It is imported correctly. However, When I tried to run example1 (or example2) this error occurred: Error occurred during initialization of boot layer java.lang.module.FindException: Module org.mockito not found, required by de.learnlib.testsupport

mtf90 commented 2 months ago

Oh wow, you are correct. It's an undetected regression of #127. The direct (and therefore deciding) dependencies of testng and mockito are test-scoped but the referenced testsupport module needs them compile-scoped. I refactored the ResumableExample (which was also broken by #127) to no longer require that dependency. As far as I can tell, things should work with 97cc60e57.

Edit: You may need to Rightclick -> Maven -> Reload project the examples project after pulling so that IntelliJ reads the new configs.