Liquibase maven 插件未使用类路径 属性
Liquibase maven plugin is not using classpath property
出于某种原因,当我在 liquibase.properties
文件中设置 Liquibase maven 插件时,它没有使用我的 属性。当我 运行 mvn liquibase:update
我得到以下信息。
[INFO] there are no resolved artifacts for the Maven project.
[INFO] Parsing Liquibase Properties File
[INFO] File: target/classes/liquibase.properties
[INFO] 'classpath' in properties file is not being used by this task.
因此,更新失败,因为 liquibase 找不到驱动程序,无法连接到数据库。
我看到了这个 SO 问题,但他们使用的是 liquibase 可执行文件而不是 maven。我用它作为如何使用 liquibase.properties 文件的示例。
Setting up Liquibase with MS-SQL Server
我看到它在哪里遇到异常 L571 到 L588 异常,但实际异常没有打印出来,所以我不知道错误的原因。
与其在属性文件中设置类路径,不如将驱动程序 jar 作为依赖项放入 maven POM 中。
请参阅 documentation for the Liquibase Maven Task,尤其是描述不同 JDBC 依赖项的部分。这是一个片段:
Example of Maven Liquibase Update
You need to ensure that you include the relevant JDBC driver for your
database in the dependency section of Maven POM file.
MySQL example:
<project>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<!-- Replace with the version of the MySQL driver you want to use -->
<version>${mysql-version}</version>
</dependency>
</dependencies>
</project>
就我而言,这是一个简单的复制和粘贴问题。
liquibase.properties
中的 属性 driver
以 space 结尾。删除 space 后一切正常。
driver: com.mysql.cj.jdbc.Driver
对
driver: com.mysql.cj.jdbc.Driver
这 让我走上了正确的方向。就我而言,我需要声明 Maven 资源。
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
希望对您有所帮助!
出于某种原因,当我在 liquibase.properties
文件中设置 Liquibase maven 插件时,它没有使用我的 属性。当我 运行 mvn liquibase:update
我得到以下信息。
[INFO] there are no resolved artifacts for the Maven project.
[INFO] Parsing Liquibase Properties File
[INFO] File: target/classes/liquibase.properties
[INFO] 'classpath' in properties file is not being used by this task.
因此,更新失败,因为 liquibase 找不到驱动程序,无法连接到数据库。
我看到了这个 SO 问题,但他们使用的是 liquibase 可执行文件而不是 maven。我用它作为如何使用 liquibase.properties 文件的示例。
Setting up Liquibase with MS-SQL Server
我看到它在哪里遇到异常 L571 到 L588 异常,但实际异常没有打印出来,所以我不知道错误的原因。
与其在属性文件中设置类路径,不如将驱动程序 jar 作为依赖项放入 maven POM 中。
请参阅 documentation for the Liquibase Maven Task,尤其是描述不同 JDBC 依赖项的部分。这是一个片段:
Example of Maven Liquibase Update
You need to ensure that you include the relevant JDBC driver for your database in the dependency section of Maven POM file.
MySQL example:
<project>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<!-- Replace with the version of the MySQL driver you want to use -->
<version>${mysql-version}</version>
</dependency>
</dependencies>
</project>
就我而言,这是一个简单的复制和粘贴问题。
liquibase.properties
中的 属性 driver
以 space 结尾。删除 space 后一切正常。
driver: com.mysql.cj.jdbc.Driver
对
driver: com.mysql.cj.jdbc.Driver
这
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
希望对您有所帮助!