Ciao, with premise I'm not a Maven expert...
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:
A. the packaging must be changed to "kjar"
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.
Failing to do so, would imply that, respectively:
A. when you run Maven with the default "mvn package" or "mvn deploy" etc, the kie-maven-plugin would not trigger
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']
Questions are:
1. Is this correct, or I'm just complicating my life without noticing, and it is existing a simpler way, please?
2. Especially point #B, is this really the intended behavior, having to replicate the dependencies in the two parts of the pom.xml ?
Thanks if somebody can feedback on this,
Ciao
MM
I'm making reference to:
For reference, here is an example pom.xml I'm using:
<modelVersion>4.0.0</modelVersion>
<groupId>com.acme</groupId>
<artifactId>my-rules</artifactId>
<version>0.0.1</version>
<!-- point #A, must set to kjar -->
<packaging>kjar</packaging>
<!-- ... -->
<dependencies>
<!-- maven artifact containing the object model or domain model objects the rules will be based on -->
<dependency>
<groupId>com.acme</groupId>
<artifactId>object-model</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>my-rules</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.kie</groupId>
<artifactId>kie-maven-plugin</artifactId>
<version>6.0.0.Final</version>
<extensions>true</extensions>
<dependencies>
<!-- point #B, the dependency must be repeated in here as well -->
<dependency>
<groupId>com.acme</groupId>
<artifactId>object-model</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
</plugins>
<!-- 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
http://wiki.eclipse.org/M2E_plugin_execution_not_covered -->
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.kie</groupId>
<artifactId>kie-maven-plugin</artifactId>
<versionRange>[6.0.0,)</versionRange>
<goals>
<goal>build</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<!-- ... -->
</project>