【问题标题】:dbunit maven plugin ordered set to true seemingly ignores tablesdbunit maven 插件有序设置为 true 看似忽略表
【发布时间】:2012-08-06 08:27:32
【问题描述】:

我正在尝试使用 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>

【问题讨论】:

    标签: maven dbunit


    【解决方案1】:

    原来语法是错误的。上面粘贴的原始返回 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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-07-14
      • 1970-01-01
      • 2015-08-16
      • 1970-01-01
      • 1970-01-01
      • 2017-05-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多