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

Split dev services into a separate module #270

Open
peteyoungs opened this issue Aug 5, 2024 · 1 comment
Open

Split dev services into a separate module #270

peteyoungs opened this issue Aug 5, 2024 · 1 comment

Comments

@peteyoungs
Copy link

Hello,

The dev services PR added a lot of dependencies that we do not want to include in a production application (TestContainers, junit, docker libs etc.) for various reasons including security
#242

I am using this extension in keycloak and the application fails to start if those dependencies are excluded due to the presence of io.quarkiverse.logging.splunk.DevServicesLoggingSplunkProcessor in the classpath (see error below)

All the dev services related code + dependencies should moved into a separate module that can be easily excluded at runtime, as is done for the core quarkus extensions
e.g. https://github.com/quarkusio/quarkus/blob/main/extensions/jdbc/jdbc-postgresql/deployment/pom.xml#L26
https://github.com/quarkusio/quarkus/blob/main/extensions/devservices/postgresql/pom.xml

ERROR: Failed to run 'build' command.
Error details:
java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doReaugment(QuarkusEntryPoint.java:90)
	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:49)
	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:33)
	at org.keycloak.quarkus.runtime.cli.command.Build.run(Build.java:85)
	at picocli.CommandLine.executeUserObject(CommandLine.java:2026)
	at picocli.CommandLine.access$1500(CommandLine.java:148)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
	at picocli.CommandLine.execute(CommandLine.java:2170)
	at org.keycloak.quarkus.runtime.cli.Picocli.parseAndRun(Picocli.java:125)
	at org.keycloak.quarkus.runtime.KeycloakMain.main(KeycloakMain.java:98)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:62)
	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:33)
Caused by: java.lang.RuntimeException: Failed to load steps from class io.quarkiverse.logging.splunk.DevServicesLoggingSplunkProcessor
	at io.quarkus.deployment.ExtensionLoader.loadStepsFrom(ExtensionLoader.java:164)
	at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:107)
	at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:330)
	at io.quarkus.runner.bootstrap.AugmentActionImpl.createProductionApplication(AugmentActionImpl.java:175)
	at io.quarkus.deployment.mutability.ReaugmentTask.main(ReaugmentTask.java:69)
	... 24 more
Caused by: java.lang.NoClassDefFoundError: org/testcontainers/containers/GenericContainer
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:508)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:468)
	at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3402)
	at java.base/java.lang.Class.getDeclaredMethods(Class.java:2504)
	at io.quarkus.deployment.ExtensionLoader.getMethods(ExtensionLoader.java:922)
	at io.quarkus.deployment.ExtensionLoader.loadStepsFromClass(ExtensionLoader.java:432)
	at io.quarkus.deployment.ExtensionLoader.loadStepsFrom(ExtensionLoader.java:162)
	... 28 more
Caused by: java.lang.ClassNotFoundException: org.testcontainers.containers.GenericContainer
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:520)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:468)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:518)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:468)
	... 38 more
@rquinio1A
Copy link
Member

Hello,

I'm not sure this is valid, as other extensions like kafka-client don't have separate modules as well: https://github.com/quarkusio/quarkus/blob/main/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/DevServicesKafkaProcessor.java
Since the DevService and its transitive dependencies come with the quarkus-logging-splunk-deployment artifact, it will not be part of the Quarkus runtime classpath (io.testcontainers or org.junit will not appear in target/quarkus-app/lib/main)

The classes will still be loaded during quarkus:build, but DevServicesLoggingSplunkProcessor actual execution can be skipped based on config.

Could you provide more details on why you want to exclude dependencies from the quarkus build classpath ? You'll likely need these dependencies for the QuarkusTests, no ?

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

No branches or pull requests

2 participants