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

Gradle: create quarkusDeploymentOnlyClasspath configuration #17473

Merged
merged 1 commit into from
May 27, 2021

Conversation

aloubyansky
Copy link
Member

Currently the exclusions configured in the Gradle scripts are ignored when resolving the deployment dependencies.
Switching to the detached configuration to a named one seems to fix it.

@glefloch this may not be needed with the refactoring you are working on but until it's merged we need this.

@aloubyansky aloubyansky requested a review from glefloch May 26, 2021 13:07
@quarkus-bot quarkus-bot bot added area/core area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/gradle Gradle labels May 26, 2021
Copy link
Member

@glefloch glefloch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, as you said, this won't be necessary in the future

@aloubyansky
Copy link
Member Author

There is something fishy with the test fixture tests. It looks like it's pulling in a different version of Quarkus/plugin

2021-05-26T19:49:01.781+0200 [DEBUG] [TestEventLogger]         Caused by:
2021-05-26T19:49:01.781+0200 [DEBUG] [TestEventLogger]         java.lang.RuntimeException: java.lang.NoSuchMethodException: io.quarkus.runner.bootstrap.AugmentActionImpl.<init>(io.quarkus.bootstrap.app.CuratedApplication, java.util.List)
2021-05-26T19:49:01.781+0200 [DEBUG] [TestEventLogger]             at io.quarkus.bootstrap.app.CuratedApplication.createAugmentor(CuratedApplication.java:120)
2021-05-26T19:49:01.781+0200 [DEBUG] [TestEventLogger]             at io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:327)
2021-05-26T19:49:01.781+0200 [DEBUG] [TestEventLogger]             at io.quarkus.test.junit.QuarkusTestExtension.ensureStarted(QuarkusTestExtension.java:662)
2021-05-26T19:49:01.781+0200 [DEBUG] [TestEventLogger]             at io.quarkus.test.junit.QuarkusTestExtension.beforeAll(QuarkusTestExtension.java:709)
2021-05-26T19:49:01.781+0200 [DEBUG] [TestEventLogger]             at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$8(ClassBasedTestDescriptor.java:368)
2021-05-26T19:49:01.781+0200 [DEBUG] [TestEventLogger]             at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
2021-05-26T19:49:01.781+0200 [DEBUG] [TestEventLogger]             at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:368)
2021-05-26T19:49:01.781+0200 [DEBUG] [TestEventLogger]             at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:192)
2021-05-26T19:49:01.781+0200 [DEBUG] [TestEventLogger]             at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:78)
2021-05-26T19:49:01.781+0200 [DEBUG] [TestEventLogger]             at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:136)
2021-05-26T19:49:01.781+0200 [DEBUG] [TestEventLogger]             ... 56 more
2021-05-26T19:49:01.781+0200 [DEBUG] [TestEventLogger] 
2021-05-26T19:49:01.781+0200 [DEBUG] [TestEventLogger]             Caused by:
2021-05-26T19:49:01.781+0200 [DEBUG] [TestEventLogger]             java.lang.NoSuchMethodException: io.quarkus.runner.bootstrap.AugmentActionImpl.<init>(io.quarkus.bootstrap.app.CuratedApplication, java.util.List)
2021-05-26T19:49:01.781+0200 [DEBUG] [TestEventLogger]                 at java.base/java.lang.Class.getConstructor0(Class.java:3349)
2021-05-26T19:49:01.781+0200 [DEBUG] [TestEventLogger]                 at java.base/java.lang.Class.getConstructor(Class.java:2151)
2021-05-26T19:49:01.781+0200 [DEBUG] [TestEventLogger]                 at io.quarkus.bootstrap.app.CuratedApplication.createAugmentor(CuratedApplication.java:118)
2021-05-26T19:49:01.781+0200 [DEBUG] [TestEventLogger]                 ... 65 more

@quarkus-bot
Copy link

quarkus-bot bot commented May 26, 2021

This workflow status is outdated as a new workflow run has been triggered.

Failing Jobs - Building 8aed262

Status Name Step Test failures Logs Raw logs
Gradle Tests - JDK 11 Build Test failures Logs Raw logs
Gradle Tests - JDK 11 Windows Build Test failures Logs Raw logs
JVM Tests - JDK 11 Build ⚠️ Check → Logs Raw logs
JVM Tests - JDK 11 Windows Build ⚠️ Check → Logs Raw logs
JVM Tests - JDK 16 Build ⚠️ Check → Logs Raw logs
Native Tests - HTTP Build ⚠️ Check → Logs Raw logs
Native Tests - Messaging1 Build ⚠️ Check → Logs Raw logs
Native Tests - Misc1 Build ⚠️ Check → Logs Raw logs
Native Tests - Misc2 Build ⚠️ Check → Logs Raw logs
Native Tests - Misc3 Build ⚠️ Check → Logs Raw logs
Native Tests - Security1 Build ⚠️ Check → Logs Raw logs
Native Tests - Security2 Build ⚠️ Check → Logs Raw logs
Native Tests - Security3 Build ⚠️ Check → Logs Raw logs

Full information is available in the Build summary check run.

Test Failures

⚙️ Gradle Tests - JDK 11 #

📦 integration-tests/gradle/build/resources/test/test-fixtures-multi-module/application

org.example.TestFixturesTest.testTestFixtures() - More details - Source on GitHub

📦 integration-tests/gradle

io.quarkus.gradle.TestFixtureMultiModuleTest.testTaskShouldUseTestFixtures() line 17 - More details - Source on GitHub


⚙️ Gradle Tests - JDK 11 Windows #

📦 integration-tests/gradle/build/resources/test/test-fixtures-multi-module/application

org.example.TestFixturesTest.testTestFixtures() - More details - Source on GitHub

📦 integration-tests/gradle

io.quarkus.gradle.TestFixtureMultiModuleTest.testTaskShouldUseTestFixtures() line 17 - More details - Source on GitHub

@aloubyansky
Copy link
Member Author

It's the AppModel initialization in the fixtures that is messed up.

@glefloch
Copy link
Member

The fixture jar may be excluded of the deployment classpath. I think I had a similar issue. I will give it a try.

@aloubyansky
Copy link
Member Author

I don't think it's about that. In the test you apply the Quarkus plugin to a module that isn't a Quarkus app, it simply imports the quarkus-bom and depends on quarkus-junit5. This initializes the beforeTest action that serializes an empty AppModel and sets the system property to its location. Then during the tests, this AppModel is deserialized and is used to initialize CuratedApplication. But it has no extension dependencies and misses the classloading config. Which results in this weird error I posted above.

@aloubyansky
Copy link
Member Author

This maybe related to testFixturesImplementation which makes quarkus-unit5 and its dependencies runtime dependencies instead of test.

@aloubyansky
Copy link
Member Author

Actually the app doesn't seem to include any extension dependency. Is resteasy missing?

@aloubyansky
Copy link
Member Author

Adding io.quarkus:quarkus-resteasy to the app actually makes the test project build and test pass but the test still fails because there is no :application:test SUCCESS in the log. Here is what I see with the debug enabled:

2021-05-27T09:31:21.812+0200 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] > Task :application:test
2021-05-27T09:31:22.153+0200 [DEBUG] [TestEventLogger] 
2021-05-27T09:31:22.153+0200 [DEBUG] [TestEventLogger] TestFixturesTest STANDARD_OUT
2021-05-27T09:31:22.154+0200 [DEBUG] [TestEventLogger]     2021-05-27 09:31:22,040 WARN  [io.qua.config] (Test worker) Unrecognized configuration key "quarkus.registry.client" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2021-05-27T09:31:22.273+0200 [DEBUG] [TestEventLogger]     2021-05-27 09:31:22,273 INFO  [io.quarkus] (Test worker) Quarkus 999-SNAPSHOT on JVM started in 1.060s. Listening on: http://localhost:8081
2021-05-27T09:31:22.274+0200 [DEBUG] [TestEventLogger]     2021-05-27 09:31:22,273 INFO  [io.quarkus] (Test worker) Profile test activated. 
2021-05-27T09:31:22.274+0200 [DEBUG] [TestEventLogger]     2021-05-27 09:31:22,273 INFO  [io.quarkus] (Test worker) Installed features: [cdi, smallrye-context-propagation]
2021-05-27T09:31:22.284+0200 [DEBUG] [TestEventLogger] 
2021-05-27T09:31:22.284+0200 [DEBUG] [TestEventLogger] TestFixturesTest > testTestFixtures() STARTED
2021-05-27T09:31:22.608+0200 [DEBUG] [TestEventLogger] 
2021-05-27T09:31:22.608+0200 [DEBUG] [TestEventLogger] TestFixturesTest > testTestFixtures() PASSED
2021-05-27T09:31:22.609+0200 [DEBUG] [TestEventLogger] 
2021-05-27T09:31:22.609+0200 [DEBUG] [TestEventLogger] TestFixturesTest PASSED
2021-05-27T09:31:22.623+0200 [DEBUG] [TestEventLogger] 
2021-05-27T09:31:22.623+0200 [DEBUG] [TestEventLogger] Gradle Test Executor 1 STANDARD_OUT
2021-05-27T09:31:22.623+0200 [DEBUG] [TestEventLogger]     2021-05-27 09:31:22,622 INFO  [io.quarkus] (Test worker) Quarkus stopped in 0.015s
2021-05-27T09:31:22.629+0200 [DEBUG] [TestEventLogger] 
2021-05-27T09:31:22.629+0200 [DEBUG] [TestEventLogger] Gradle Test Executor 1 PASSED
2021-05-27T09:31:22.655+0200 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: SUCCEEDED
2021-05-27T09:31:22.655+0200 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Process 'Gradle Test Executor 1' finished with exit value 0 (state: SUCCEEDED)
2021-05-27T09:31:22.656+0200 [DEBUG] [org.gradle.internal.work.DefaultWorkerLeaseService] Worker lease root.1.21.473 completed (1 worker(s) in use)
2021-05-27T09:31:22.656+0200 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Dispatch org.gradle.api.internal.tasks.testing.processors.RestartEveryNTestClassProcessor@5b5db335: released lock on root.1.21.473
2021-05-27T09:31:22.657+0200 [DEBUG] [TestEventLogger] 
2021-05-27T09:31:22.657+0200 [DEBUG] [TestEventLogger] Gradle Test Run :application:test PASSED

The other issue is that the classpath with test fixtures is wrong, i.e. the runtime classpath includes deployment dependencies.

@aloubyansky
Copy link
Member Author

@glefloch would you mind looking into these issues?

@glefloch
Copy link
Member

Yes, I'm checking out your branch.

@aloubyansky
Copy link
Member Author

I think you should be able to reproduce it with the main as well.

@aloubyansky
Copy link
Member Author

I think this PR is good to merge. I'll add a little adjustment though.

@aloubyansky
Copy link
Member Author

I may have a local change that also contributed to the mess.

@aloubyansky
Copy link
Member Author

I think this PR is good to merge.

@glefloch
Copy link
Member

we should fix the test before merging no ?

@aloubyansky
Copy link
Member Author

Either way will be ok to me. AFAICT, the test failure isn't related to the change in the PR.

…figuration for the deployment only dependencies
@glefloch glefloch force-pushed the quarkusDeploymentOnlyClasspath branch from 8aed262 to d7e8da7 Compare May 27, 2021 08:51
@glefloch
Copy link
Member

I was able to reproduce the error on your branch. I pushed a fix that just add resteasy so it will not break main. I will work on correctly handling testFixtures classpath issues.

@aloubyansky
Copy link
Member Author

Thanks @glefloch

@glefloch glefloch merged commit 57dad8b into quarkusio:main May 27, 2021
@quarkus-bot quarkus-bot bot added this to the 2.1 - main milestone May 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/gradle Gradle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants