簡體   English   中英

<outputFile>使用sql-maven-plugin時屬性無法正常工作

[英]<outputFile> property not working properly while using sql-maven-plugin

我正在使用sql-maven-plugin執行一個簡單的數據庫測試用例。

首先,我要在表中插入兩行數據(注意:在執行此操作之前,我會手動截斷表)

然后,我運行一個選擇查詢以檢查是否插入了這兩行。

為了檢查是否插入了這兩行,我正在使用sql-maven-plugin的屬性將查詢結果保存到文件中。

但是在運行maven之后,將創建輸出文件,但其中不包含任何數據。 大小為0 KB。

請建議我哪里出錯了,或者使用maven-sql-plugin在文件中獲取查詢輸出的任何其他方法。

提前致謝

在下面添加了我的pom.xml的executions標簽:-

      <execution>
        <id>insert-data</id>
        <phase>process-test-resources</phase>
        <goals>
          <goal>execute</goal>
        </goals>
        <configuration>
          <autocommit>true</autocommit>

          <srcFiles>
            <srcFile>insert-in-usage.sql</srcFile>
          </srcFiles>
        </configuration>
      </execution>

      <execution>
        <id>select-data</id>
        <phase>process-test-resources</phase>
        <goals>
          <goal>execute</goal>
        </goals>

        <configuration>
         <sqlCommand>select distinct decode(count(*),2,'PASS','FAIL') as results from usage where version='3';</sqlCommand>
          <outputFile>result.xls</outputFile>
        </configuration>
      </execution>

    </executions>

對於像我這樣多年后來到這里的新用戶:您必須添加參數

<printResultSet>true</printResultSet>

在配置中。 根據說明文件 ,此版本自1.3版起已提供。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM