【发布时间】:2014-01-14 12:04:40
【问题描述】:
我正在使用 maven dbunit 插件(调整版本 1.0-beta-3)。
在我的pom.xml 文件中,我定义了一些执行次数很少的插件:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>dbunit-maven-plugin</artifactId>
<!--jar file that has the jdbc driver -->
<dependencies>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
</dependency>
</dependencies>
<configuration>
<driver>org.postgresql.Driver</driver>
<dataTypeFactoryName>org.dbunit.ext.postgresql.PostgresqlDataTypeFactory</dataTypeFactoryName>
<useQualifiedTableNames>true</useQualifiedTableNames>
</configuration>
<executions>
<!-- INSERTS -->
<execution>
<id>RequestDaoIT</id>
<phase>post-integration-test</phase>
<goals>
<goal>operation</goal>
</goals>
<configuration>
<url>jdbc:postgresql://${db.host}:${db.port}/${db.name}</url>
<username>${db.username}</username>
<password>${db.password}</password>
<format>flat</format>
<type>INSERT</type>
<src>src/test/resources/dbunit/RequestDaoIT.xml</src>
</configuration>
</execution>
<execution>
<id>SlotDaoIT</id>
<phase>post-integration-test</phase>
<goals>
<goal>operation</goal>
</goals>
<configuration>
<url>jdbc:postgresql://${db.host}:${db.port}/${db.name}</url>
<username>${db.username}</username>
<password>${db.password}</password>
<format>flat</format>
<type>INSERT</type>
<src>src/test/resources/dbunit/SlotDaoIT.xml</src>
</configuration>
</execution>
... CUT
在mvn verify 构建期间第二次执行时出现以下错误:
[ERROR] Failed to execute goal org.codehaus.mojo:dbunit-maven-plugin:1.0-XXXX:operation (SlotDaoIT) on project xxx-xxxxx-xxxxxx: Error executing database operation: INSERT: Current thread was interrupted (Thread=Thread[main,5,main]): NullPointerException -> [Help 1]
谁能告诉我可能出了什么问题?我在 SO 或谷歌的任何地方都找不到它。谢谢!
【问题讨论】:
-
刚刚发现了一个错误,即那些插入应该在
pre-integration-test阶段执行。会再跑一次。
标签: java postgresql maven dbunit