找不到数据库驱动程序:org.postgresql.Driver
|
我试图通过Liquibase升级它来改变一个项目.它是一个 Java EE项目.所以我使用liquibase-maven-plugin. 到目前为止我在我的pom.xml中: <plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>2.0.5</version>
<configuration>
<propertyFileWillOverride>true</propertyFileWillOverride>
<propertyFile>src/main/resources/liquibase.properties</propertyFile>
<changeLogFile>src/main/resources/changelogs/changelog.xml</changeLogFile>
</configuration>
<executions>
<execution>
<!-- Another Error: plugin execution not covered by lifecycle configuration..-->
<!-- <phase>process-resources</phase> <goals> <goal>update</goal> </goals> -->
</execution>
</executions>
</plugin>
其中已包含一个驱动程序: <dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901-1.jdbc4</version>
</dependency>
liquibase.properties文件包含url,username,password,changeLogFile-Path和驱动程序: #liquibase.properties driver: org.postgresql.Driver 但它没有驱动程序的类路径.我也需要类路径吗? changelog.xml有一个简单的变更集,可以创建一个表,只是为了测试liquibase的开头. 但我到目前为止还没来,因为当我用这个项目运行时 mvn liquibase:update 我得到这个错误: [错误]无法执行目标org.liquibase:liquibase-maven-plugin:2.0.5:更新(default-cli)项目PROJECT:设置或运行Liquibase时出错:java.lang.RuntimeException:找不到数据库驱动程序:org .postgresql.Driver 我看不出这一点..驱动程序已经在项目之前使用过了.那么为什么liquibase找不到呢? 编辑 当我通过添加驱动程序标签在pom.xml中编辑我的配置时,它可以工作: <configuration>
<propertyFileWillOverride>true</propertyFileWillOverride>
<propertyFile>src/main/resources/liquibase.properties</propertyFile>
<changeLogFile>src/main/resources/changelogs/changelog.xml</changeLogFile>
<driver>org.postgresql.Driver</driver>
</configuration>
之前我的驱动程序是在liquibase.properties中指定的,它实际上也可以正常工作. 也许有人可以告诉我如果我想将驱动程序保存在属性文件中liquibase.properties文件应该是什么样子. 解决方法您已将postgresql驱动程序添加为您的webapp的依赖项.但是当maven插件运行时,它们有自己的类路径,这与您的webapp不同.因此,您需要为插件本身包含对JDBC驱动程序的依赖(同样适用于其他插件,例如jetty-maven-plugin):<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>2.0.5</version>
<configuration>
<propertyFileWillOverride>true</propertyFileWillOverride>
<propertyFile>src/main/resources/liquibase.properties</propertyFile>
<changeLogFile>src/main/resources/changelogs/changelog.xml</changeLogFile>
</configuration>
<executions>
<execution>
<!-- Another Error: plugin execution not covered by lifecycle configuration..-->
<!-- <phase>process-resources</phase> <goals> <goal>update</goal> </goals> -->
</execution>
</executions>
<dependencies>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901-1.jdbc4</version>
</dependency>
</dependencies>
</plugin>
编辑: 通过更换解决了这个问题驱动程序:org.postgresql.Driver,其中包含liquibase.properties文件中的driver = org.postgresql.Driver. (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- sql-server – 如何将数据库从SQL Server 2012移动到SQL Se
- sql-server – 阻塞进程报告中的空阻塞进程
- sql – select(Oracle)中的组编号
- sql-server-2008-r2 – 在SQL Server Reporting Services中
- MySQL操作之JSON数据类型操作详解
- 深入SqlServer2008 数据库同步的两种方式(Sql JOB)的分析介
- sql – 是否有一个表包含sysobjects.xtype描述的列表?
- 如何使用一个SQL语句删除MySQL数据库中的所有触发器?
- sqlserver多版本查看版本号
- sql-server – 在SQL Reporting Services中,如何根据参数过
