0

我正在尝试使用 db-unit-maven 插件导出我的部分数据库。我在我的配置中将有序标志设置为 true,以便我可以重新导入它以避免违反完整性约束。我还使用配置中的表元素指定要导出的表。我在下面粘贴了一个我正在尝试做的例子。但是,它将在约束方面与在配置中手动选择的那些无关的其他表导出。是否<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>
4

1 回答 1

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>
于 2012-08-06T19:30:57.317 回答