[英]<outputFile> property not working properly while using sql-maven-plugin
I am using sql-maven-plugin to perform a simple DB testcase. 我正在使用sql-maven-plugin执行一个简单的数据库测试用例。
Firstly , I am inserting 2 rows of data into a table(note: I am truncating the table manually before doing this) 首先,我要在表中插入两行数据(注意:在执行此操作之前,我会手动截断表)
Then I am running a select query to check if those 2 rows are inserted. 然后,我运行一个选择查询以检查是否插入了这两行。
To check if those 2 rows are inserted I am using property of sql-maven-plugin to get the query result in a file. 为了检查是否插入了这两行,我正在使用sql-maven-plugin的属性将查询结果保存到文件中。
But after running maven, output file is created but it does not contain any data. 但是在运行maven之后,将创建输出文件,但其中不包含任何数据。 Size is of 0 KB. 大小为0 KB。
Please suggest where Im going wrong or any other method of getting output of query in a file using maven-sql-plugin. 请建议我哪里出错了,或者使用maven-sql-plugin在文件中获取查询输出的任何其他方法。
Thanks in Advance 提前致谢
Added executions tag of my pom.xml below :- 在下面添加了我的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>
For new users coming here after years like me: you have to add the parameter 对于像我这样多年后来到这里的新用户:您必须添加参数
<printResultSet>true</printResultSet>
in the configuration. 在配置中。 It's been available since version 1.3, according to documentation . 根据说明文件 ,此版本自1.3版起已提供。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.