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

Continuous testing doesn't support provided dependencies #22552

Closed
famod opened this issue Dec 29, 2021 · 4 comments · Fixed by #23089
Closed

Continuous testing doesn't support provided dependencies #22552

famod opened this issue Dec 29, 2021 · 4 comments · Fixed by #23089
Labels
Milestone

Comments

@famod
Copy link
Member

famod commented Dec 29, 2021

Describe the bug

Using a class from a provided scoped dependency in a test (in whichever way) results in a ClassNotFoundException when the test is run in continuous testing mode.

Expected behavior

Class is found, just like when surefire is running the test.

Actual behavior

ClassNotFoundException

How to Reproduce?

q_ct-provided.zip

  • mvn clean verify does not fail (ProvidedTest passes)
  • mvn quarkus:dev
  • resume tests
  • fails with:
    ERROR [io.qua.test] (Test runner thread) Test ProvidedTest#load() failed: java.lang.NoClassDefFoundError: lombok/experimental/SuperBuilder
            at org.acme.ProvidedTest.load(ProvidedTest.java:11)
    Caused by: java.lang.ClassNotFoundException: lombok.experimental.SuperBuilder
            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)
            at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:455)
            at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:405)
            at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:455)
            at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:405)
            ... 1 more
    

lombok might be a strange example, but in my real project I have a test based on javaparser that verifies the expected usage of lombok annotations (which have source retention, so ArchUnit is not usable here).

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.6.1.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Maven 3.8.4

Additional information

Probably related:

//horrible hack
//we really need a compiler per module but we are not setup for this yet
//if a module has test scoped dependencies that are not in the application then
//compilation can fail
//note that we already have a similar issue with provided scoped deps, and so far nobody
//has complained much

@famod famod added the kind/bug Something isn't working label Dec 29, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Dec 29, 2021

/cc @stuartwdouglas

@famod
Copy link
Member Author

famod commented Dec 29, 2021

/cc @aloubyansky

@stuartwdouglas
Copy link
Member

@aloubyansky it looks like the 'provided' scoped dep is not ending up in the model, but for the 'mvn verify' use case it is on the class path so can be loaded from the system CL.

@aloubyansky
Copy link
Member

Yes, it makes sense actually. I'll add provided dependencies in the test mode.

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

Successfully merging a pull request may close this issue.

4 participants