Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Developing in eclipse becomes a pain #2653

Closed
rPraml opened this issue Apr 14, 2022 · 11 comments
Closed

Developing in eclipse becomes a pain #2653

rPraml opened this issue Apr 14, 2022 · 11 comments
Milestone

Comments

@rPraml
Copy link
Contributor

rPraml commented Apr 14, 2022

First of all: This is not really an ebean issue, but maybe I can get some tips here, how to proceed.

We are using eclipse. Unfortunately with Ebean 13, the code base becomes incompatibe with eclipse
I think the main reason is JPMS / bad JPMS support in eclipse (and maybe also my lack of knowledge about JPMS)

Expected behavior

  • run untitests from eclipse
  • get no compile errors in eclipse

Actual behavior

  • I cannot start unittests from eclipse at all (Can be fixed by adding
    --add-exports org.junit.platform.commons/org.junit.platform.commons.util=ALL-UNNAMED
    and --add-exports org.junit.platform.commons/org.junit.platform.commons.logging=ALL-UNNAMED) I found that tip here https://www.edvpfau.de/junit5-debugging-mit-eclipse-und-gradle/
  • If Unittest starts, it fails because I think, some module-infos are not yet correct (at least for tests. I did some modifications here: FOCONIS@e65d9bd, @rbygrave maybe you can check that)
  • I get lots of compile erros as the test classes were not able to access the modules. For example:
    grafik
    grafik

Steps to reproduce

Checkout current master and import it in eclipse (Version 2022-03)

Note

Currently I run the tests in maven, but this makes it harder to debug (and it costs also more time)
I also noticed, that I get similar errors if I enable surefire.useModulePath in the POM file.
(Unfortunately I did not find this option in eclipse)

@rbygrave
Copy link
Member

I get similar errors if I enable surefire.useModulePath

Well, there are no compile errors when I set that to true and do mvn clean test-compile (and that's as I expect as this does not impact maven compile). So you'll need to be more explicit as to what you mean here (check if this is really on master branch using the latest maven plugins in particular).

Eclipse Compile behavior

We can look closely at how maven-compile-plugin is working and ideally compare that with Eclipse IDE compilation.

TLDR: maven-compile-plugin is NOT using surefire.useModulePath at all. That is a surefire only configuration option and not impacting the compilation of src/main or compilation of src/test.

Example steps:

  1. mvn clean install (have locally installed all the snapshots)
  2. cd ebean-core
  3. mvn clean test-compile -X
  4. look at the command line args maven-compile-plugin is using to compile src/main and src/test
  5. Add <surefire.useModulePath>true</surefire.useModulePath>
  6. mvn clean test-compile -X
  7. look at the command line args maven-compile-plugin is using to compile src/main and src/test
  8. compare 4 and 7

What we see is that the compilation command line args used by maven-compiler-plugin is not different. More specifically for us we especialy looking at the compilation args used to compile src/test and noting that isn't different.

command line options for compiling src/test

...
[DEBUG] Command line options:
[DEBUG] -d /home/rob/github/ebean-orm/ebean/ebean-core/target/test-classes -classpath /home/rob/github/ebean-orm/ebean/ebean-core/target/test-classes:/home/rob/.m2/repository/com/h2database/h2/2.1.212/h2-2.1.212.jar:/home/rob/.m2/repository/org/checkerframework/checker-qual/3.5.0/checker-qual-3.5.0.jar:/home/rob/.m2/repository/io/ebean/ebean-platform-h2/13.3.1-SNAPSHOT/ebean-platform-h2-13.3.1-SNAPSHOT.jar:/home/rob/.m2/repository/io/ebean/ebean-platform-postgres/13.3.1-SNAPSHOT/ebean-platform-postgres-13.3.1-SNAPSHOT.jar:/home/rob/.m2/repository/io/ebean/ebean-platform-sqlserver/13.3.1-SNAPSHOT/ebean-platform-sqlserver-13.3.1-SNAPSHOT.jar:/home/rob/.m2/repository/io/ebean/ebean-datasource/7.5/ebean-datasource-7.5.jar:/home/rob/.m2/repository/io/avaje/junit/1.1/junit-1.1.jar:/home/rob/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.8.2/junit-jupiter-api-5.8.2.jar:/home/rob/.m2/repository/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar:/home/rob/.m2/repository/org/junit/platform/junit-platform-commons/1.8.2/junit-platform-commons-1.8.2.jar:/home/rob/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/home/rob/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.8.2/junit-jupiter-engine-5.8.2.jar:/home/rob/.m2/repository/org/junit/platform/junit-platform-engine/1.8.2/junit-platform-engine-1.8.2.jar:/home/rob/.m2/repository/org/assertj/assertj-core/3.22.0/assertj-core-3.22.0.jar:/home/rob/.m2/repository/org/mockito/mockito-core/4.4.0/mockito-core-4.4.0.jar:/home/rob/.m2/repository/net/bytebuddy/byte-buddy/1.12.8/byte-buddy-1.12.8.jar:/home/rob/.m2/repository/net/bytebuddy/byte-buddy-agent/1.12.8/byte-buddy-agent-1.12.8.jar:/home/rob/.m2/repository/org/objenesis/objenesis/3.2/objenesis-3.2.jar:/home/rob/.m2/repository/ch/qos/logback/logback-classic/1.2.11/logback-classic-1.2.11.jar:/home/rob/.m2/repository/ch/qos/logback/logback-core/1.2.11/logback-core-1.2.11.jar: --module-path /home/rob/github/ebean-orm/ebean/ebean-core/target/classes:/home/rob/.m2/repository/io/ebean/ebean-ddl-runner/1.3/ebean-ddl-runner-1.3.jar:/home/rob/.m2/repository/io/avaje/classpath-scanner/6.2/classpath-scanner-6.2.jar:/home/rob/.m2/repository/io/avaje/classpath-scanner-api/6.2/classpath-scanner-api-6.2.jar:/home/rob/.m2/repository/io/ebean/ebean-migration-auto/1.2/ebean-migration-auto-1.2.jar:/home/rob/.m2/repository/io/ebean/ebean-api/13.3.1-SNAPSHOT/ebean-api-13.3.1-SNAPSHOT.jar:/home/rob/.m2/repository/io/avaje/avaje-config/1.7/avaje-config-1.7.jar:/home/rob/.m2/repository/io/avaje/avaje-lang/1.0/avaje-lang-1.0.jar:/home/rob/.m2/repository/io/ebean/persistence-api/2.2.5/persistence-api-2.2.5.jar:/home/rob/.m2/repository/io/ebean/ebean-annotation/8.0/ebean-annotation-8.0.jar:/home/rob/.m2/repository/io/ebean/ebean-types/2.2/ebean-types-2.2.jar:/home/rob/.m2/repository/io/ebean/ebean-datasource-api/7.5/ebean-datasource-api-7.5.jar:/home/rob/.m2/repository/io/ebean/ebean-core-type/13.3.1-SNAPSHOT/ebean-core-type-13.3.1-SNAPSHOT.jar:/home/rob/.m2/repository/io/ebean/ebean-externalmapping-api/13.3.1-SNAPSHOT/ebean-externalmapping-api-13.3.1-SNAPSHOT.jar:/home/rob/.m2/repository/org/antlr/antlr4-runtime/4.8-1/antlr4-runtime-4.8-1.jar:/home/rob/.m2/repository/io/avaje/avaje-jsr305-x/1.1/avaje-jsr305-x-1.1.jar:/home/rob/.m2/repository/javax/transaction/javax.transaction-api/1.3/javax.transaction-api-1.3.jar:/home/rob/.m2/repository/javax/validation/validation-api/2.0.1.Final/validation-api-2.0.1.Final.jar:/home/rob/.m2/repository/jakarta/validation/jakarta.validation-api/3.0.0/jakarta.validation-api-3.0.0.jar:/home/rob/.m2/repository/joda-time/joda-time/2.9.7/joda-time-2.9.7.jar:/home/rob/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.13.2/jackson-core-2.13.2.jar:/home/rob/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.13.2/jackson-databind-2.13.2.jar:/home/rob/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.13.2/jackson-annotations-2.13.2.jar:/home/rob/.m2/repository/org/postgresql/postgresql/42.3.3/postgresql-42.3.3.jar:/home/rob/.m2/repository/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar: -sourcepath /home/rob/github/ebean-orm/ebean/ebean-core/src/test/java:/home/rob/github/ebean-orm/ebean/ebean-core/target/generated-test-sources/test-annotations: -s /home/rob/github/ebean-orm/ebean/ebean-core/target/generated-test-sources/test-annotations -g -nowarn --release 11 -encoding UTF-8 -Xlint:all --patch-module io.ebean.core=/home/rob/github/ebean-orm/ebean/ebean-core/target/classes:/home/rob/github/ebean-orm/ebean/ebean-core/src/test/java:/home/rob/github/ebean-orm/ebean/ebean-core/target/generated-test-sources/test-annotations: --add-reads io.ebean.core=ALL-UNNAMED
...

Note the use in here of both -classpath AND --module-path (and --patch-module and --add-reads ...)

Now, in looking at Eclipse IDE and all the compilation errors, what this suggests to me is that Eclipse IDE [with maven and not gradle] is clearly not doing the same thing wrt the command line args it is using for compiling src/test? Can we determine what eclipse compile actually does when compiling tests via IDE logs or something [to compare the command line args]?

WRT testing with module-info, projects have the choice of looking to specify a test specific module-info or not. With Ebean we have chosen to not use test specific module-info. With this choice the "tooling" (aka maven tooling) is expected to "do the right thing" when compile test code noting that we don't have a test specific module-info. Hence the mix of classpath and module-path we see when compiling test code.

I'd prefer to stick to this approach of not having test specific module-info. Ideally the "tooling" all agrees to what the expected behavior is for compiling and running test code (and we have a case here of the Eclipse IDE tooling disagreeing with the maven tooling).

Obviously if this gets painful then the option is open to use IntelliJ IDEA instead of Eclipse IDE when we are working on Ebean itself - not ideal obviously (but I'm kind of pointing the finger specifically at any tooling that isn't consistent with maven as the tooling that is less correct).

@rbygrave
Copy link
Member

I get lots of compile errors as the test classes were not able to access the modules. For example:

Note that I also saw these compile errors. What Eclipse IDE compile seemed to want is some of the maven <scope>test</scope> dependencies to instead be <scope>provided</scope> and be included in the module-info explicitly as requires [static] ... ... somewhat along the lines of wanting a test specific module-info (which some tooling supports [especially gradle] but is a path I don't want to go down).

That is, maven (and IntelliJ) were happy with these test scope dependencies staying as test scope with no explicit mention in module-info and yet Eclipse IDE compile needed these to be in module-path (incorrectly).

What I think maven tooling is doing wrt tests is approximately "creating a new unnamed module that 'patches in' everything from src/main plus adds in via classpath the test dependencies".

@rPraml
Copy link
Contributor Author

rPraml commented Apr 20, 2022

Thanks for your feedback. It seems that there is currently no solution/workaround for eclipse

As I understand this bug report
https://bugs.eclipse.org/bugs/show_bug.cgi?id=559601
eclipse does not support multiple JPMS modules per maven project.

While having a src/test/java/module-info.java is supported in maven, it is currently not supported in eclipse.
I assume, if there is no src/test/java/module-info.java present, maven treats the test code as "unnamed module" while eclipse does not. (It uses src/main/java/module-info.java also for test-compile, which is wrong)

Options that I see now:

  • split test code in separate maven module (IMHO no option for me and you)
  • reconfiguring class paths in eclipse manally (unfortunately, M2E will overwrite this)
  • Switch IDE (Maybe I'll give it a try with IntelliJ CE ;) )
  • Wait until the bug above is closed (May take some time)

@rbygrave
Copy link
Member

Hmmm. I don't know exactly what the eclipse compiler is doing, it would be good to know for sure ... I wonder if there is any way to find out.

@rPraml
Copy link
Contributor Author

rPraml commented Apr 20, 2022

I am currently debugging this.
(To debug eclipse, you need to add -Xdebug -Xnoagent and -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=0.0.0.0:4242 to eclipse.ini)

What I've found out till now

I did not yet figure out, what happens here exactly

@rPraml
Copy link
Contributor Author

rPraml commented Apr 28, 2022

Hello @rbygrave,

after spending some time of debugging the eclipse compiler, I give up to fix this problem in eclipse.
So we decideded to switch the IDE to IntelliJ (at least for ebean and later maybe also for other projects)
Unfortunately, we (@nPraml , @jonasPoehler and me) still have the problem that tests will also not run in IntelliJ:

How to reproduce:

  • use latest IntelliJ: IntelliJ IDEA 2022.1 (Community Edition)
  • checkout current master
  • try to run a test in "ebean-test" (e.g io.ebean.test.DbJsonTest)
  • It will fail with TestEngine with ID 'junit-jupiter' failed to discover tests, Caused by: java.lang.NoClassDefFoundError: org/junit/jupiter/api/parallel/ExecutionMode (details see below)
  • other tests (not in ebean-test) e.g. io.ebean.bean.ToStringBuilderTest will work
  • Workaround: Edit launch config and select "do not use --module-path option"

Is it correct/neccessary to check that option or do we miss something?

Output of working test

/usr/lib/jvm/java-11-openjdk-amd64/bin/java -ea -Didea.test.cyclic.buffer.size=1048576 -javaagent:/home/roland/dev/idea-IC-221.5080.210/lib/idea_rt.jar=43633:/home/roland/dev/idea-IC-221.5080.210/bin --patch-module io.ebean.api=/home/roland/dev/ebean/ebean-api/target/test-classes --add-reads io.ebean.api=ALL-UNNAMED --add-opens io.ebean.api/io.ebean.bean=ALL-UNNAMED --add-modules io.ebean.api -Dfile.encoding=UTF-8 -classpath /home/roland/.m2/repository/org/junit/platform/junit-platform-launcher/1.8.2/junit-platform-launcher-1.8.2.jar:/home/roland/dev/idea-IC-221.5080.210/lib/idea_rt.jar:/home/roland/dev/idea-IC-221.5080.210/plugins/junit/lib/junit5-rt.jar:/home/roland/dev/idea-IC-221.5080.210/plugins/junit/lib/junit-rt.jar:/home/roland/dev/ebean/ebean-api/target/test-classes:/home/roland/.m2/repository/javax/transaction/jta/1.1/jta-1.1.jar:/home/roland/.m2/repository/io/avaje/junit/1.1/junit-1.1.jar:/home/roland/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.8.2/junit-jupiter-api-5.8.2.jar:/home/roland/.m2/repository/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar:/home/roland/.m2/repository/org/junit/platform/junit-platform-commons/1.8.2/junit-platform-commons-1.8.2.jar:/home/roland/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/home/roland/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.8.2/junit-jupiter-engine-5.8.2.jar:/home/roland/.m2/repository/org/junit/platform/junit-platform-engine/1.8.2/junit-platform-engine-1.8.2.jar:/home/roland/.m2/repository/org/assertj/assertj-core/3.22.0/assertj-core-3.22.0.jar:/home/roland/.m2/repository/org/mockito/mockito-core/4.4.0/mockito-core-4.4.0.jar:/home/roland/.m2/repository/net/bytebuddy/byte-buddy/1.12.8/byte-buddy-1.12.8.jar:/home/roland/.m2/repository/net/bytebuddy/byte-buddy-agent/1.12.8/byte-buddy-agent-1.12.8.jar:/home/roland/.m2/repository/org/objenesis/objenesis/3.2/objenesis-3.2.jar:/home/roland/.m2/repository/ch/qos/logback/logback-classic/1.2.11/logback-classic-1.2.11.jar:/home/roland/.m2/repository/ch/qos/logback/logback-core/1.2.11/logback-core-1.2.11.jar:/home/roland/.m2/repository/com/h2database/h2/2.1.212/h2-2.1.212.jar -p /home/roland/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar:/home/roland/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.13.2/jackson-annotations-2.13.2.jar:/home/roland/.m2/repository/io/avaje/avaje-lang/1.0/avaje-lang-1.0.jar:/home/roland/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.13.2/jackson-core-2.13.2.jar:/home/roland/.m2/repository/io/ebean/ebean-datasource-api/7.5/ebean-datasource-api-7.5.jar:/home/roland/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.13.2/jackson-databind-2.13.2.jar:/home/roland/.m2/repository/io/ebean/ebean-types/2.2/ebean-types-2.2.jar:/home/roland/.m2/repository/io/ebean/ebean-annotation/8.0/ebean-annotation-8.0.jar:/home/roland/dev/ebean/ebean-api/target/classes:/home/roland/.m2/repository/io/avaje/avaje-config/1.7/avaje-config-1.7.jar:/home/roland/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:/home/roland/.m2/repository/io/ebean/persistence-api/2.2.5/persistence-api-2.2.5.jar com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit5 io.ebean.bean.ToStringBuilderTest

Process finished with exit code 0

Output of failing test:

/usr/lib/jvm/java-11-openjdk-amd64/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:42131,suspend=y,server=n -ea -Didea.test.cyclic.buffer.size=1048576 -javaagent:/home/roland/dev/idea-IC-221.5080.210/plugins/java/lib/rt/debugger-agent.jar --patch-module io.ebean.test=/home/roland/dev/ebean/ebean-test/target/test-classes --add-reads io.ebean.test=ALL-UNNAMED --add-opens io.ebean.test/io.ebean.test=ALL-UNNAMED --add-modules io.ebean.test -Dfile.encoding=UTF-8 -classpath /home/roland/.m2/repository/org/junit/platform/junit-platform-launcher/1.8.2/junit-platform-launcher-1.8.2.jar:/home/roland/.m2/repository/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar:/home/roland/.m2/repository/org/junit/platform/junit-platform-commons/1.8.2/junit-platform-commons-1.8.2.jar:/home/roland/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/home/roland/dev/idea-IC-221.5080.210/lib/idea_rt.jar:/home/roland/dev/idea-IC-221.5080.210/plugins/junit/lib/junit5-rt.jar:/home/roland/dev/idea-IC-221.5080.210/plugins/junit/lib/junit-rt.jar:/home/roland/dev/ebean/ebean-test/target/test-classes:/home/roland/dev/ebean/platforms/h2/target/classes:/home/roland/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.6/jaxb-runtime-2.3.6.jar:/home/roland/.m2/repository/org/glassfish/jaxb/txw2/2.3.6/txw2-2.3.6.jar:/home/roland/.m2/repository/com/sun/istack/istack-commons-runtime/3.0.12/istack-commons-runtime-3.0.12.jar:/home/roland/dev/ebean/platforms/all/target/classes:/home/roland/dev/ebean/platforms/clickhouse/target/classes:/home/roland/dev/ebean/platforms/db2/target/classes:/home/roland/dev/ebean/platforms/hana/target/classes:/home/roland/dev/ebean/platforms/hsqldb/target/classes:/home/roland/dev/ebean/platforms/mysql/target/classes:/home/roland/dev/ebean/platforms/mariadb/target/classes:/home/roland/dev/ebean/platforms/nuodb/target/classes:/home/roland/dev/ebean/platforms/oracle/target/classes:/home/roland/dev/ebean/platforms/postgres/target/classes:/home/roland/dev/ebean/platforms/sqlanywhere/target/classes:/home/roland/dev/ebean/platforms/sqlite/target/classes:/home/roland/dev/ebean/platforms/sqlserver/target/classes:/home/roland/.m2/repository/io/avaje/mod-uuid/1.3/mod-uuid-1.3.jar:/home/roland/.m2/repository/javax/transaction/jta/1.1/jta-1.1.jar:/home/roland/.m2/repository/commons-io/commons-io/2.7/commons-io-2.7.jar:/home/roland/.m2/repository/com/microsoft/sqlserver/mssql-jdbc/9.4.0.jre8/mssql-jdbc-9.4.0.jre8.jar:/home/roland/.m2/repository/mysql/mysql-connector-java/8.0.26/mysql-connector-java-8.0.26.jar:/home/roland/.m2/repository/com/google/protobuf/protobuf-java/3.11.4/protobuf-java-3.11.4.jar:/home/roland/.m2/repository/org/mariadb/jdbc/mariadb-java-client/2.6.0/mariadb-java-client-2.6.0.jar:/home/roland/.m2/repository/com/sap/cloud/db/jdbc/ngdbc/2.3.48/ngdbc-2.3.48.jar:/home/roland/.m2/repository/com/oracle/database/jdbc/ojdbc8/19.12.0.0/ojdbc8-19.12.0.0.jar:/home/roland/.m2/repository/com/ibm/db2/jcc/11.5.6.0/jcc-11.5.6.0.jar:/home/roland/.m2/repository/org/xerial/sqlite-jdbc/3.36.0.3/sqlite-jdbc-3.36.0.3.jar:/home/roland/.m2/repository/com/nuodb/jdbc/nuodb-jdbc/22.0.0/nuodb-jdbc-22.0.0.jar:/home/roland/.m2/repository/ru/yandex/clickhouse/clickhouse-jdbc/0.3.1-patch/clickhouse-jdbc-0.3.1-patch.jar:/home/roland/.m2/repository/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar:/home/roland/.m2/repository/org/apache/httpcomponents/httpcore/4.4.13/httpcore-4.4.13.jar:/home/roland/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/home/roland/.m2/repository/commons-codec/commons-codec/1.11/commons-codec-1.11.jar:/home/roland/.m2/repository/org/apache/httpcomponents/httpmime/4.5.13/httpmime-4.5.13.jar:/home/roland/.m2/repository/org/lz4/lz4-java/1.7.1/lz4-java-1.7.1.jar:/home/roland/.m2/repository/ch/qos/logback/logback-classic/1.2.10/logback-classic-1.2.10.jar:/home/roland/.m2/repository/ch/qos/logback/logback-core/1.2.10/logback-core-1.2.10.jar:/home/roland/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.8.2/junit-jupiter-engine-5.8.2.jar:/home/roland/.m2/repository/org/junit/platform/junit-platform-engine/1.8.2/junit-platform-engine-1.8.2.jar:/home/roland/.m2/repository/org/mockito/mockito-core/4.4.0/mockito-core-4.4.0.jar:/home/roland/.m2/repository/org/objenesis/objenesis/3.2/objenesis-3.2.jar -p /home/roland/.m2/repository/io/avaje/classpath-scanner/6.2/classpath-scanner-6.2.jar:/home/roland/.m2/repository/io/ebean/ebean-test-docker/4.6/ebean-test-docker-4.6.jar:/home/roland/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.8.2/junit-jupiter-api-5.8.2.jar:/home/roland/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.13.2/jackson-datatype-jsr310-2.13.2.jar:/home/roland/.m2/repository/net/bytebuddy/byte-buddy-agent/1.12.8/byte-buddy-agent-1.12.8.jar:/home/roland/.m2/repository/jakarta/validation/jakarta.validation-api/3.0.0/jakarta.validation-api-3.0.0.jar:/home/roland/dev/ebean/ebean-api/target/classes:/home/roland/dev/ebean/ebean-externalmapping-api/target/classes:/home/roland/.m2/repository/io/avaje/junit/1.1/junit-1.1.jar:/home/roland/dev/ebean/ebean-test/target/classes:/home/roland/.m2/repository/org/antlr/antlr4-runtime/4.8-1/antlr4-runtime-4.8-1.jar:/home/roland/.m2/repository/io/ebean/ebean-ddl-runner/1.3/ebean-ddl-runner-1.3.jar:/home/roland/.m2/repository/io/avaje/classpath-scanner-api/6.2/classpath-scanner-api-6.2.jar:/home/roland/.m2/repository/org/assertj/assertj-core/3.22.0/assertj-core-3.22.0.jar:/home/roland/.m2/repository/io/ebean/persistence-api/2.2.5/persistence-api-2.2.5.jar:/home/roland/.m2/repository/com/h2database/h2/2.1.212/h2-2.1.212.jar:/home/roland/.m2/repository/org/postgresql/postgresql/42.3.3/postgresql-42.3.3.jar:/home/roland/.m2/repository/io/ebean/ebean-migration-auto/1.2/ebean-migration-auto-1.2.jar:/home/roland/.m2/repository/jakarta/xml/bind/jakarta.xml.bind-api/2.3.3/jakarta.xml.bind-api-2.3.3.jar:/home/roland/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.13.2/jackson-databind-2.13.2.jar:/home/roland/.m2/repository/io/ebean/ebean-types/2.2/ebean-types-2.2.jar:/home/roland/.m2/repository/net/bytebuddy/byte-buddy/1.12.8/byte-buddy-1.12.8.jar:/home/roland/.m2/repository/com/sun/activation/jakarta.activation/1.2.2/jakarta.activation-1.2.2.jar:/home/roland/.m2/repository/jakarta/activation/jakarta.activation-api/1.2.1/jakarta.activation-api-1.2.1.jar:/home/roland/.m2/repository/io/ebean/ebean-migration/12.13.0/ebean-migration-12.13.0.jar:/home/roland/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/home/roland/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.13.2/jackson-core-2.13.2.jar:/home/roland/.m2/repository/io/ebean/ebean-datasource/7.5/ebean-datasource-7.5.jar:/home/roland/.m2/repository/joda-time/joda-time/2.9.7/joda-time-2.9.7.jar:/home/roland/.m2/repository/io/avaje/avaje-jsr305-x/1.1/avaje-jsr305-x-1.1.jar:/home/roland/.m2/repository/io/avaje/avaje-lang/1.0/avaje-lang-1.0.jar:/home/roland/.m2/repository/io/ebean/ebean-annotation/8.0/ebean-annotation-8.0.jar:/home/roland/dev/ebean/ebean-core/target/classes:/home/roland/.m2/repository/org/junit/platform/junit-platform-commons/1.8.2/junit-platform-commons-1.8.2.jar:/home/roland/.m2/repository/io/avaje/avaje-config/1.7/avaje-config-1.7.jar:/home/roland/.m2/repository/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar:/home/roland/dev/ebean/ebean-core-type/target/classes:/home/roland/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.13.2/jackson-annotations-2.13.2.jar:/home/roland/.m2/repository/javax/validation/validation-api/2.0.1.Final/validation-api-2.0.1.Final.jar:/home/roland/.m2/repository/org/slf4j/slf4j-api/1.7.32/slf4j-api-1.7.32.jar:/home/roland/.m2/repository/io/ebean/ebean-datasource-api/7.5/ebean-datasource-api-7.5.jar:/home/roland/dev/ebean/ebean-ddl-generator/target/classes com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit5 io.ebean.test.DbJsonTest
Connected to the target VM, address: '127.0.0.1:42131', transport: 'socket'
Internal Error occurred.
org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-jupiter' failed to discover tests
	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:160)
	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverSafely(EngineDiscoveryOrchestrator.java:134)
	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:108)
	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:80)
	at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:110)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
	at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
	at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:71)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
	at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: java.lang.NoClassDefFoundError: org/junit/jupiter/api/parallel/ExecutionMode
	at org.junit.jupiter.engine.JupiterTestEngine.discover(JupiterTestEngine.java:66)
	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:152)
	... 13 more
Caused by: java.lang.ClassNotFoundException: org.junit.jupiter.api.parallel.ExecutionMode
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	... 15 more
Disconnected from the target VM, address: '127.0.0.1:42131', transport: 'socket'

Process finished with exit code 254

@rbygrave
Copy link
Member

rbygrave commented May 2, 2022

Workaround: Edit launch config and select "do not use --module-path option"

Ah yes. I use that and in fact I have modified IntelliJ junit to default to having this option ... sorry, I kind of forgot that.

Noting that this means that running tests in IntelliJ is then similar to maven surefire which is configured to use classpath via <surefire.useModulePath>false</surefire.useModulePath>.

@rPraml
Copy link
Contributor Author

rPraml commented May 2, 2022

I see that you've added some documentation here
From my point, we can close this issue

@rbygrave
Copy link
Member

rbygrave commented May 2, 2022

Ok cool - closing.

@rbygrave rbygrave closed this as completed May 2, 2022
@rbygrave rbygrave added this to the 13.5.1 milestone May 2, 2022
@rbygrave
Copy link
Member

rbygrave commented May 2, 2022

Also grabbing your other comment @rPraml to put it in here:


@rbygrave FYI: This bug is reported here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=577790

We currently use the eclipse compiler (ecj) in nearly all of our projects as it supports multi-threading and is almost twice as fast as javac. And it behaves exactly the same as in eclipse. (There are some code places, where the javac expects excplicit casts, while ecj does not)

We do not use JPMS, yet, but we intend to use it. We are also seriously considering moving from Eclipse/Ecj to IntelliJ/Javac due to the issues I've seen over the past few weeks...

@agentgt
Copy link

agentgt commented Jun 9, 2023

EDIT Oh I didn't see the multi-module release issue... I wonder why have not stumbled on to that.

FWIW as I use Eclipse and there are some projects where this is an issue but it isn't really Eclipses fault. There is no effective way to merge modules and I'm not quite sure what Maven does for src/test/java/module-info.java. I largely blame the JDK devs on not coming up with a consensus on the unit test issue.

The easiest solution is to isolate your code that has issues and just generate the module-info.class with something like moditect. That is make it look like the project is a regular classpath project to Eclipse.

Or if this is just a unit test issue do blackbox testing. Besides src/test/java/module-info.java can actually be misleading and even Maven's patching in of modules can lead to what works as a Unit Test but not work when actually deployed.

Other than that I actually think Eclipse's support for modules is sometimes better than Intellij (I'm not sure why but Intellij doesn't seem to narrow the ctrl+space search to just module selection for me).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants