kie-maven-plugin fails to compile when using external dependencies
Issue
- Creating a kjar using the maven plugin (mvn clean package) throws a compile error when trying to import a class from a project dependency even though the class exists in the dependency jar.
[ERROR] Unable to build KieBaseModel:defaultKieBase
Unable to resolve ObjectType 'Person' : [Rule name='Hello']
Rule Compilation error : [Rule name='Hello']
com/sample/Rule_Hello1775578265.java (7:387) : $p cannot be resolved
Error importing : 'com.sample.Person'
[ERROR] Message [id=1, kieBase=defaultKieBase, level=ERROR, path=Sample.drl, line=7, column=0
text=Unable to resolve ObjectType 'Person']
[ERROR] Message [id=2, kieBase=defaultKieBase, level=ERROR, path=Sample.drl, line=5, column=0
text=Rule Compilation error $p cannot be resolved]
[ERROR] Message [id=3, kieBase=defaultKieBase, level=ERROR, path=Sample.drl, line=1, column=0
text=Error importing : 'com.sample.Person']
[ERROR] Failed to execute goal org.kie:kie-maven-plugin:6.5.0.Final-redhat-2:build (default-build) on project Drools64Ex015_kjar_transitive_dep: Execution default-build of goal org.kie:kie-maven-plugin:6.5.0.Final-redhat-2:build failed: A required class was missing while executing org.kie:kie-maven-plugin:6.5.0.Final-redhat-2:build: org/apache/commons/lang/StringUtils
[ERROR] -----------------------------------------------------
[ERROR] realm = extension>org.kie:kie-maven-plugin:6.5.0.Final-redhat-2
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/home/tkobayas/.m2/repository/org/kie/kie-maven-plugin/6.5.0.Final-redhat-2/kie-maven-plugin-6.5.0.Final-redhat-2.jar
[ERROR] urls[1] = file:/home/tkobayas/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.20/plexus-utils-3.0.20.jar
...
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] -> [Help 1]
Environment
- Red Hat JBoss BPM Suite
- 6.4
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
