[rules-users] "Cannot find KieModule" with kieServices.newKieContainer() with LATEST or RELEASE instead of explicit version number (eg: 0.0.1)

Matteo Mortari matteo.mortari at gmail.com
Mon Feb 3 12:48:05 EST 2014


Ciao Mario,
thank you for your feedback, I believe could be indeed Maven related, but
frankly what led me raise the bug in the Drools Jira, it looks like this is
an issue only when Drools is invoking the Maven API ? - all my other Maven
workflows with 'mvn' builds command are working fine.

Indeed the complexity is due to the requirement where artifactId will be
known only at runtime, in my case. That's why I've made that simple test
project, because it would simulate the fetch from a remote maven repo - in
that case I could parametrize the hardcoded artifactId String to a variable
as well.

Here is a question concerning to your last feedback, please.

Assuming the .m2 local repository is missing completely the
com\acme\drools6testmvnlatest.therules directory...
If I specify the remote Maven repo in the settings, the code example
provided, should be able to remotely fetch and install from remote
repository, right ?
Because despite my maven remote repositories are specified in the
~/.m2/settings.xml or in the same file passed as the
-Dkie.maven.settings.custom=
system property, still get the same problem, either I explicit version
number, either I ask for RELEASE or LATEST.

Example:
D:\inbox>java -jar -Dkie.maven.settings.custom=D:/inbox/settings.xml
drools6testmvnlatest.thestandaloneengine-jar-with-dependencies.jar 0.0.2
2014-02-03 18:28:57,017 [pool-1-thread-1] INFO
 com.ning.http.client.providers.netty.NettyAsyncHttpProvider - Number of
application's worked threads is 8
2014-02-03 18:28:57,361 [pool-3-thread-1] INFO
 com.ning.http.client.providers.netty.NettyAsyncHttpProvider - Number of
application's worked threads is 8
Exception in thread "main" java.lang.RuntimeException: Cannot find
KieModule: com.acme:drools6testmvnlatest.therules:0.0.2
        at
org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieContainer(KieServicesImpl.java:86)
        at
com.acme.drools6testmvnlatest.thestandaloneengine.App.main(App.java:24)

I've also tried the different combination of windows-horror-slash, just to
be sure, but result is always the same.

I attach the content of my settings.xml file below, in case I'm missing
something stupid.
If you can kindly advise what's your perspective, please, because I've
rechecked the documentation several times but frankly I think I'm doing all
by the book, yet not able to making it recognize the remote maven repo ?

Thanks;
Ciao
MM

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>

<profile>
      <id>nexus-hostname-nexus</id>
      <repositories>
        <repository>
<id>nexus-hostname-nexus</id>
<name>nexus-hostname-nexus</name>
 <releases>
<enabled>true</enabled>
  </releases>
  <snapshots>
 <enabled>true</enabled>
  </snapshots>
 <url>http://nexus-hostname/nexus/content/repositories/releases</url>
 </repository>
<repository>
 <id>nexus-hostname-nexus-snapshots</id>
<name>nexus-hostname-nexus</name>
 <releases>
<enabled>false</enabled>
  </releases>
  <snapshots>
 <enabled>true</enabled>
  </snapshots>
 <url>http://nexus-hostname/nexus/content/repositories/snapshots</url>
 </repository>
      </repositories>
      </profile>


</profiles>
<activeProfiles>
    <activeProfile>nexus-hostname-nexus</activeProfile>
  </activeProfiles>
</settings>



On Fri, Jan 31, 2014 at 5:47 PM, Mario Fusco <mario.fusco at gmail.com> wrote:

> Ciao Matteo,
>
> I tried the test case attached to DROOLS-419 and it works for me.
>
> To be more precise what I tried it is simply installing the kjar you
> provided on my local maven repo and check that the main class of your
> second
> project is able to retrieve the kjar and build the drools project using
> both
> LATEST and RELEASE as version.
>
> I realize the use case you described is quite more complex, but I believe
> the additional complexity is all maven related and has nothing to do with
> Drools. Moreover if you need to use additional (external) maven
> repositories
> my suggestion is to try to configure them in your settings.xml file. Also
> be
> aware that you can define a location for an alternative settings.xml file
> (and then define there the additional repositories you need if you want)
> using the system property kie.maven.settings.custom like in:
>
> java -jar -Dkie.maven.settings.custom=/my/alternative/settings.xml
> drools6testmvnlatest.thestandaloneengine-jar-with-dependencies.jar RELEASE
>
> I hope this helps, but if I am missing some important detail and you still
> think the issue you reported could be somewhat related with Drools please
> let me know.
>
> Thanks,
> Mario
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/rules-users-Cannot-find-KieModule-with-kieServices-newKieContainer-with-LATEST-or-RELEASE-instead-of-tp4027941p4027957.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20140203/384b1568/attachment-0001.html 


More information about the rules-users mailing list