Found several problems with using the kmodule ruleTemplate
I have a rule project that had been working fine. In the project I had a template file and a Java command to generate drl files from the template and a spreadsheet file. The command supported csv, xls, and xlsx files. The project was awkward to use.
I had missed the fact that the kmodule had the runTemplate attribute that would allow the kmodule to take the spreadsheet and generate the drl file without having to have a command that parsed the file to generate the drl file. Great!
I edited the kmodule definition to add the ruleTemplate, referencing a csv file.
Enter code here... <ruleTemplate dtable="rules/business/TermSearchQFRules.csv"
template="rules/business/templates/TermSearchQF.drt"
row="2" col="1"/>
ran "mvn install"
the kmodule code couldn't parse the csv file...
[ERROR] Failed to execute goal org.kie:kie-maven-plugin:7.8.0.Final:build (default-build) on project ba-search-kjar: Execution default-build of goal org.kie:kie-maven-plugin:7.8.0.Final:build failed: An error occurred opening the workbook. It is possible that the encoding of the document did not match the encoding of the reader. Your InputStream was neither an OLE2 stream, nor an OOXML stream -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.kie:kie-maven-plugin:7.8.0.Final:build (default-build) on project ba-search-kjar: Execution default-build of goal org.kie:kie-maven-plugin:7.8.0.Final:build failed: An error occurred opening the workbook. It is possible that the encoding of the document did not match the encoding of the reader.
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-build of goal org.kie:kie-maven-plugin:7.8.0.Final:build failed: An error occurred opening the workbook. It is possible that the encoding of the document did not match the encoding of the reader.
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: org.drools.template.parser.DecisionTableParseException: An error occurred opening the workbook. It is possible that the encoding of the document did not match the encoding of the reader.
at org.drools.decisiontable.parser.xls.ExcelParser.parseFile(ExcelParser.java:87)
Well that sucked...
Removed the csv file and replaced it with the .xlsx file I used to generate it.
The error changed.
[ERROR] Failed to execute goal org.kie:kie-maven-plugin:7.8.0.Final:build (default-build) on project ba-search-kjar: Execution default-build of goal org.kie:kie-maven-plugin:7.8.0.Final:build failed: No RuleTable cells in spreadsheet. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.kie:kie-maven-plugin:7.8.0.Final:build (default-build) on project ba-search-kjar: Execution default-build of goal org.kie:kie-maven-plugin:7.8.0.Final:build failed: No RuleTable cells in spreadsheet.
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-build of goal org.kie:kie-maven-plugin:7.8.0.Final:build failed: No RuleTable cells in spreadsheet.
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: org.drools.template.parser.DecisionTableParseException: No RuleTable cells in spreadsheet.
I decided to revert the kmodule.xml to remove the ruleTemplate element, I again ran maven and got the same error! It seemed just having the spreadsheet file in the rules folder caused the kie plugin to try to compile it into drl files, but it cannot tell that this is a spreadsheet that uses a template.
I suspect that the problem is with the kie maven plugin, org.kie:kie-maven-plugin
We use the kie-maven-plugin to compile our drools projects.
I want to use the kmodule with the ruleTemplate. I'd really like it to work with csv files as we'll be keeping them in source control and would prefer to not have to store binary files
I am currently using KIE 7.8.0.Final