title: How to deploy multiple KieModules into a single KieBase
body: <p>I am looking into ways to deploy multiple <code>KieModule</code>s represented by multiple Maven artifacts into a single <code>KieContainer</code>. Here are my requirements:</p>
  
  <ol>
  <li>Users define rules, package them,</li>
  <li>They install the package on a Maven repo,</li>
  <li>They use a RESTful api to inform the Spring application that there are new rules deployed with some groupId, artifactId and version (in the request body), so the application can go and pick the new <code>KieModule</code> and add it to the <code>KieContainer</code>.</li>
  </ol>
  
  <p>Basically what would have been great is:</p>
  
  <pre><code>KieServices ks = KieServices.Factory.get();
  KieContainer kContainer = ks.getKieClasspathContainer();
  kContainer.addKieModule(someKieModule); // This doesn't exist
  kContainer.addKieModule(someOtherKieModule); // This doesn't exist
  </code></pre>
  
  <p>So far, all I could see is that there's a one-to-one relationship in between <code>KieContainer</code> and <code>KieModule</code>. Is this true? I am also aware that I can group my artifacts under a parent artifact and deploy it every time it is updated, but I don't wan't to enforce my business users to group their artifacts (as that would also make them dependent on each other).</p>
  
  <p>I am also open to alternative suggestions on how to achieve this (Maybe having multiple <code>KieModule</code>'s files, loop through them, and add them one by one into a <code>KieContainer</code>)?</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>Update</strong></p>
  
  <p>I am also experimenting with <code>DeploymentService</code>, specifically <code>KModuleDeploymentService</code>, but I am not sure if it achieves what I would like to achieve. I would also appreciate if you could enlighten me on this.</p>
  
  <p><strong>Update#2</strong></p>
  
  <p>It seems like <code>KieBuilder</code> may help according to <a href="https://developer.jboss.org/wiki/SonOfKie" rel="nofollow noreferrer">this</a>. So do you think that:</p>
  
  <pre><code>KieFactory kf = KieFactory.Factory.get();
  KieFileSystem kfs = kf.newKieFileSystem();          
  KieBuilder kb = ks.newKieBuilder(kfs);
  kb.setDependencies(someKieModule, someOtherKieModule);
  kb.build();
  KieContainer kContainer = ks.getKieContainer(kr.getDefaultGAV());
  </code></pre>
  
  <p>would work?</p>