如何将PostgreSQL驱动程序(jar)添加到使用liberty-maven-plugin创建的开放自由微配置文件胖jar中?

问题描述 投票:0回答:1

我正在尝试将PostgreSQL与MicroProfile应用程序一起使用,但是无法加载驱动程序。我的server.xml包含以下内容:

<dataSource jndiName="jdbc/reports">
    <jdbcDriver libraryRef="PostgresLib" />
    <properties.postgresql serverName="localhost"
                           portNumber="5432"
                           databaseName="reports"
                           user="reports"
                           password="reports"/>
</dataSource>

<library id="PostgresLib">
    <fileset dir="${server.config.dir}/lib"
             includes="postgresql-42.2.9.jar"/>
</library>

我试图通过maven-dependency-plugin复制jar文件,但是target / liberty文件夹中没有jar文件。我想liberty-maven-plugin之前会清除文件夹。我还向我的pom.xml添加了以下依赖项:

<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>42.2.9</version>
</dependency>

我想念什么?

java postgresql maven jpa open-liberty
1个回答
0
投票

看起来不错。您所要做的就是在pom.xml中添加Postgres-Maven依赖关系,并使用maven构建应用程序。这告诉Maven下载Postgres库并将其添加到您的类路径中(无需手动下载和复制该库)。

© www.soinside.com 2019 - 2024. All rights reserved.