我正在尝试使用db-unit-maven插件导出我的数据库的一部分。我在我的配置中将ordered标志设置为true,以便我可以重新导入它,避免完整性约束违规。我还使用配置中的tables元素指定要导出的表。我粘贴了一个我想要做的例子。
但是,它会将与约束无关的其他表导出到配置中手动选择的表。 <ordered>true</order>
会导致列表被忽略吗?我错过了什么?
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>dbunit-maven-plugin</artifactId>
<version>1.0-beta-3</version>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.1.0</version>
</dependency>
</dependencies>
<configuration>
<driver>oracle.jdbc.OracleDriver</driver>
<url>${it.datasource.url}</url>
<username>${dbunit.username}</username>
<password>${dbunit.password}</password>
<dataTypeFactoryName>org.dbunit.ext.oracle.OracleDataTypeFactory</dataTypeFactoryName>
<skipOracleRecycleBinTables>true</skipOracleRecycleBinTables>
</configuration>
<executions>
<execution>
<id>execute</id>
<phase>package</phase>
<goals>
<goal>export</goal>
</goals>
<configuration>
<schema>${dbunit.username}</schema>
<format>xml</format>
<dest>target/dbunit/export.xml</dest>
<tables>
<table name="TABLE_1" />
<table name="TABLE_2" />
</tables>
<ordered>true</ordered>
</configuration>
</execution>
</executions>
</plugin>
答案 0 :(得分:0)
事实证明语法错误。上面粘贴的原始文件返回NullPointerException
,下面粘贴了正确的语法,据我所知,它的行为符合预期。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>dbunit-maven-plugin</artifactId>
<version>1.0-beta-3</version>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.1.0</version>
</dependency>
</dependencies>
<configuration>
<driver>oracle.jdbc.OracleDriver</driver>
<url>${it.datasource.url}</url>
<username>${dbunit.username}</username>
<password>${dbunit.password}</password>
<dataTypeFactoryName>org.dbunit.ext.oracle.OracleDataTypeFactory</dataTypeFactoryName>
<skipOracleRecycleBinTables>true</skipOracleRecycleBinTables>
</configuration>
<executions>
<execution>
<id>execute</id>
<phase>package</phase>
<goals>
<goal>export</goal>
</goals>
<configuration>
<schema>${dbunit.username}</schema>
<format>xml</format>
<dest>target/dbunit/export.xml</dest>
<tables>
<table>
<name>TABLE_1</name>
</table>
<table>
<name>TABLE_2</name>
</table>
</tables>
<ordered>true</ordered>
</configuration>
</execution>
</executions>
</plugin>