从依赖项加载资源

时间:2020-03-25 11:40:44

标签: maven quarkus

我有一个带有休息端点的Quarkus应用程序(命名为cosmicApp)。我添加了一个maven依赖项,该依赖项具有一些用@Path@GET注释的类。但是,这些资源在应用程序运行时不可用。 cosmicApp中的类在添加的依赖项中使用类,因此它应该在那里。 只是缺少资源。 有提示吗?

两个项目都使用

<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-resteasy</artifactId>
</dependency>
<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-resteasy-jackson</artifactId>
</dependency>

Quarkus 1.2.1最终版

1 个答案:

答案 0 :(得分:1)

我认为您必须以某种方式从依赖项注册资源。一种可能的选择是在config.properties中提供配置参数,以确定应包含在依赖项上下文中的工件:

quarkus.index-dependency.<name>.group-id=<your dependency group ID>
quarkus.index-dependency.<name>.artifact-id=<your dependency artifact ID>

您还可以使用beans.xml或Jandex索引。请参阅文档:https://quarkus.io/guides/cdi-reference