<div dir="ltr">Ciao, with premise I'm not a Maven expert...<div><div><br></div><div>I'm following now the new recommended version for 6.0 KIE project/module development as documented in [1] by generating a new maven archetype "quickstart" but if compared to the documentation I found, at least in my case, I had at a minimum to apply also the following in the pom.xml:</div>
<div>A. the packaging must be changed to "kjar"</div><div>B. if the project and the rules depend on an external library/maven artifact, say for instance the object model or domain model objects the rules will be based on, it is NOT enough to declare them in the pom.xml <dependencies>, but the exact same dependencies MUST ALSO be also declared within the kie-maven-plugin <plugin> <dependencies> as well.</div>
</div><div><br></div><div>Failing to do so, would imply that, respectively:</div><div>A. when you run Maven with the default "mvn package" or "mvn deploy" etc, the kie-maven-plugin would not trigger</div>
<div>B. kie-maven-plugin will fail the build because unable to resolve the "external" classes referenced in the .drl, with a message similar to [ERROR] Message [id=3, level=ERROR, path=package.drl, line=3, column=0 text=Unable to find class 'classname']<br>
<br></div><div>Questions are:<br></div><div>1. Is this correct, or I'm just complicating my life without noticing, and it is existing a simpler way, please?</div><div>2. Especially point #B, is this really the intended behavior, having to replicate the dependencies in the two parts of the pom.xml ?</div>
<div><br></div><div>Thanks if somebody can feedback on this,</div><div>Ciao</div><div>MM</div><div><br></div><div>I'm making reference to:</div><div>[1] <a href="http://docs.jboss.org/drools/release/6.0.0.Final/drools-docs/html_single/#KIEModuleIntroductionBuildingIntroductionSection">http://docs.jboss.org/drools/release/6.0.0.Final/drools-docs/html_single/#KIEModuleIntroductionBuildingIntroductionSection</a></div>
<div><br></div><div>For reference, here is an example pom.xml I'm using:</div><div><br></div><div><div><project xmlns="<a href="http://maven.apache.org/POM/4.0.0">http://maven.apache.org/POM/4.0.0</a>" xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>" xsi:schemaLocation="<a href="http://maven.apache.org/POM/4.0.0">http://maven.apache.org/POM/4.0.0</a> <a href="http://maven.apache.org/xsd/maven-4.0.0.xsd">http://maven.apache.org/xsd/maven-4.0.0.xsd</a>"></div>
<div> <modelVersion>4.0.0</modelVersion></div><div><br></div><div> <groupId>com.acme</groupId></div><div> <artifactId>my-rules</artifactId></div><div> <version>0.0.1</version></div>
<div> </div><div> <!-- point #A, must set to kjar --></div><div> <packaging>kjar</packaging></div><div><br></div><div> <!-- ... --></div><div><br></div><div><span class="" style="white-space:pre">        </span><dependencies></div>
<div><span class="" style="white-space:pre">                </span><!-- maven artifact containing the object model or domain model objects the rules will be based on --> </div><div><span class="" style="white-space:pre">                </span><dependency></div>
<div><span class="" style="white-space:pre">                        </span><groupId>com.acme</groupId></div><div><span class="" style="white-space:pre">                        </span><artifactId>object-model</artifactId></div><div><span class="" style="white-space:pre">                        </span><version>0.0.1-SNAPSHOT</version></div>
<div><span class="" style="white-space:pre">                </span></dependency></div><div><br></div><div><span class="" style="white-space:pre">                </span><dependency></div><div><span class="" style="white-space:pre">                        </span><groupId>junit</groupId></div>
<div><span class="" style="white-space:pre">                        </span><artifactId>junit</artifactId></div><div><span class="" style="white-space:pre">                        </span><version>4.11</version></div><div><span class="" style="white-space:pre">                        </span><scope>test</scope></div>
<div><span class="" style="white-space:pre">                </span></dependency></div><div><span class="" style="white-space:pre">        </span></dependencies></div><div><br></div><div><span class="" style="white-space:pre">        </span><build></div>
<div><span class="" style="white-space:pre">                </span><finalName>my-rules</finalName></div><div><span class="" style="white-space:pre">                </span><plugins></div><div><span class="" style="white-space:pre">                        </span><plugin></div>
<div><span class="" style="white-space:pre">                                </span><artifactId>maven-compiler-plugin</artifactId></div><div><span class="" style="white-space:pre">                                </span><configuration></div><div><span class="" style="white-space:pre">                                        </span><source>1.7</source></div>
<div><span class="" style="white-space:pre">                                        </span><target>1.7</target></div><div><span class="" style="white-space:pre">                                </span></configuration></div><div><span class="" style="white-space:pre">                        </span></plugin></div>
<div><span class="" style="white-space:pre">                        </span><plugin></div><div><br></div><div><span class="" style="white-space:pre">                                </span><groupId>org.kie</groupId></div><div><span class="" style="white-space:pre">                                </span><artifactId>kie-maven-plugin</artifactId></div>
<div><span class="" style="white-space:pre">                                </span><version>6.0.0.Final</version></div><div><span class="" style="white-space:pre">                                </span><extensions>true</extensions></div><div><span class="" style="white-space:pre">                                </span><dependencies></div>
<div><br></div><div><span class="" style="white-space:pre">                                        </span><!-- point #B, the dependency must be repeated in here as well --></div><div><span class="" style="white-space:pre">                                        </span><dependency></div>
<div><span class="" style="white-space:pre">                                                </span><groupId>com.acme</groupId></div><div><span class="" style="white-space:pre">                                                </span><artifactId>object-model</artifactId></div><div><span class="" style="white-space:pre">                                                </span><version>0.0.1-SNAPSHOT</version></div>
<div><span class="" style="white-space:pre">                                        </span></dependency></div><div><br></div><div><span class="" style="white-space:pre">                                </span></dependencies></div><div><span class="" style="white-space:pre">                        </span></plugin></div>
<div><span class="" style="white-space:pre">                </span></plugins></div><div><br></div><div><span class="" style="white-space:pre">                </span><!-- The following is added to avoid Eclipse ERROR at the pom.xml line defining the kie-maven-plugin, by explicitly telling Eclipse to avoid run the plugin on Eclipse-build, leaving it trigger only when running Maven, eg "mvn package" or "mvn deploy", etc etc , see <a href="http://wiki.eclipse.org/M2E_plugin_execution_not_covered">http://wiki.eclipse.org/M2E_plugin_execution_not_covered</a> --></div>
<div><span class="" style="white-space:pre">                </span><pluginManagement></div><div><span class="" style="white-space:pre">                        </span><plugins></div><div><span class="" style="white-space:pre">                                </span><plugin></div>
<div><span class="" style="white-space:pre">                                        </span><groupId>org.eclipse.m2e</groupId></div><div><span class="" style="white-space:pre">                                        </span><artifactId>lifecycle-mapping</artifactId></div>
<div><span class="" style="white-space:pre">                                        </span><version>1.0.0</version></div><div><span class="" style="white-space:pre">                                        </span><configuration></div><div><span class="" style="white-space:pre">                                                </span><lifecycleMappingMetadata></div>
<div><span class="" style="white-space:pre">                                                        </span><pluginExecutions></div><div><span class="" style="white-space:pre">                                                                </span><pluginExecution></div><div><span class="" style="white-space:pre">                                                                        </span><pluginExecutionFilter></div>
<div><span class="" style="white-space:pre">                                                                                </span><groupId>org.kie</groupId></div><div><span class="" style="white-space:pre">                                                                                </span><artifactId>kie-maven-plugin</artifactId></div>
<div><span class="" style="white-space:pre">                                                                                </span><versionRange>[6.0.0,)</versionRange></div><div><span class="" style="white-space:pre">                                                                                </span><goals></div><div><span class="" style="white-space:pre">                                                                                        </span><goal>build</goal></div>
<div><span class="" style="white-space:pre">                                                                                </span></goals></div><div><span class="" style="white-space:pre">                                                                        </span></pluginExecutionFilter></div><div><span class="" style="white-space:pre">                                                                        </span><action></div>
<div><span class="" style="white-space:pre">                                                                                </span><ignore /></div><div><span class="" style="white-space:pre">                                                                        </span></action></div><div><span class="" style="white-space:pre">                                                                </span></pluginExecution></div>
<div><span class="" style="white-space:pre">                                                        </span></pluginExecutions></div><div><span class="" style="white-space:pre">                                                </span></lifecycleMappingMetadata></div><div><span class="" style="white-space:pre">                                        </span></configuration></div>
<div><span class="" style="white-space:pre">                                </span></plugin></div><div><span class="" style="white-space:pre">                        </span></plugins></div><div><span class="" style="white-space:pre">                </span></pluginManagement></div>
<div><span class="" style="white-space:pre">        </span></build></div><div><span class="" style="white-space:pre">        </span></div><div> <!-- ... --></div><div> </div><div></project></div></div><div><br></div>
</div>