[rules-users] Drool 6.0.0.Final, 2 question re kie-maven-plugin, please?

Matteo Mortari matteo.mortari at gmail.com
Thu Dec 5 11:35:04 EST 2013


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:
[1]
http://docs.jboss.org/drools/release/6.0.0.Final/drools-docs/html_single/#KIEModuleIntroductionBuildingIntroductionSection

For reference, here is an example pom.xml I'm using:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="
http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20131205/ddcdb5f4/attachment-0001.html 


More information about the rules-users mailing list