I have a Quarkus module that defines an abstract REST class. It contains Qute templates which should be injected. Then I have my application which uses the module as dependency and implements a REST service which extends the abstract REST class.
If I use a template directly in my application (in the REST service), it works. But if I want to use a template in my dependent Maven module, I always get an error, because the template is not found.
So how can I use Qute within a dependency?
Here's some more information about the structure: I have src/main/resources/templates/health_state.html
in my module.
In the abstract base class, I use
@Inject
@Location("health_state.html")
Template healthState;
At startup time, I get this error:
No template found for path [health_state.html] defined at foobar.quarkus.healthcheck.AbstractHealthCheckResource#healthState
- available templates: []
at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1516)
at io.quarkus.arc.processor.BeanProcessor.processValidationErrors(BeanProcessor.java:180)
at io.quarkus.arc.deployment.ArcProcessor.generateResources(ArcProcessor.java:518)
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:568)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
at java.base/java.lang.Thread.run(Thread.java:840)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Have you made your external module discoverable for Quarkus ? If not try this first: https://stackoverflow.com/a/75046455/2979325
If this also doesn’t work, then a dirty solution might be to unpack your templates into the current project build folder by using the following maven plugin: https://stackoverflow.com/a/61246960/2979325