Loading Drools/KIE Workbench artifacts directly from the repository

前端 未结 3 796
北海茫月
北海茫月 2020-12-02 16:14

We try to switch to Drools 6 with the all new KIE workbench (formerly known as Guvnor) and the new maven-based artifacts.

Now I\'d like to use the the system describ

3条回答
  •  感动是毒
    2020-12-02 16:44

    The code above uses maven and kie-ci. The URLResource you create is not used.

    Here's a working sample :

        String url = "http://localhost:8080/kie-drools-wb/maven2/groupId/artifactId/1.0/artifactId-1.0.jar";
    
        KieServices ks = KieServices.Factory.get();
        KieRepository kr = ks.getRepository();
        UrlResource urlResource = (UrlResource) ks.getResources()
                .newUrlResource(url);
        urlResource.setUsername("admin");
        urlResource.setPassword("password");
        urlResource.setBasicAuthentication("enabled");
        InputStream is = urlResource.getInputStream();
        KieModule kModule = kr.addKieModule(ks.getResources()
                .newInputStreamResource(is));
    
        KieContainer kContainer = ks.newKieContainer(kModule.getReleaseId());
    
        kContainer.newStatelessKieSession();
    

    Note that you still need to tweak a bit to allow this to work with the KieScanner.

提交回复
热议问题