Updating KIE Execution Server container with updated rules file - maven

This is where I am at:
I am using Drools 6.2 and calling drools engine remotely via KIE Execution Server running on jboss.
I used workbench to create my initial drl file and fact objects and then used Build & Deploy option of workbench to create and deploy the jar file. I then created the container using the jar file and got the end point that I am using to access the rule engine from my client application. At this point every thing is working fine and I am able to fire the rules remotely.
My requirement is to modify the rules file (.drl) outside the workbench, let's say in notepad and update the container with this new drl file. Is there an easy way to create the jar file programmatically that i can deploy to the central maven repository? I can then run the KIE scanner to look for the latest version of my jar file and automatically update my container. Or is there another recommended way to update the running container with an updated .drl file?
My client application is not in Java so I am not looking for an integrated solution where I can write java code to create the knowledge base and use kie builder to build the drl file.

Is there an easy way to create the jar file programmatically that i can deploy to the central maven repository?
2 options that I can think of, one "easy" and one not so much:
Option 1
Use Maven and the maven drools plugin (you don't have to write Java code, just create your maven project and run mvn package to get a jar. See here: https://docs.jboss.org/drools/release/6.0.1.Final/drools-docs/html/KIEChapter.html#KIEModuleIntroductionBuildingIntroductionSection
Option 2
A JAR file is simply a zip file with a specified structure. That means that you should be able to update your whatever.drl file, put it in the directory structure that the KIE server expects and deploy it.
For instance, create a directory structure like:
META-INF/kmodule.xml
com/site/project/drools/rules/myrule/SomeRule.drl
Zip those files into somefile.jar and deploy it.

Related

Injection Dependy of a Multimodule Maven project in Maven

I have the following issue.
On one hand I have a multi module maven project, which I use maven install to write the .jar files in my local .m2 repository. This is working fine. Lets call it MultiA.
Now on the other hand, I have a spring boot project (lets call it SpringB) in which I bind the .jar files from my multi module maven project. This is working fine as well. When I execute my buisness logic from IntelliJ, I receive no issue, but when I build the project as a .jar, I receive an issue because the settings.properties file from MultiA are not found. I do not try to access settings.properties from SpringB, but I call a method from MultiA, which in return trys to access the settings properties.
I hope, this description helps and someone knows the answer to this problem.

Spring Boot fastest way to deploy instead of build Jar?

I am new to Spring Boot from php world. In Php development, it is simple to make changes on the file, upload and run.
But on Spring boot, my development relies on remote ubuntu server, every time I make change in *.java, I have to build the Fat Jar, upload the Jar, kill the current java process on ubuntu, and run the java -jar my.jar again, which spend much time on the upload because the Jar is about 60 mb.
Is there any way I can work like php, just upload the changed file, so the spring boot just compile the class and run?
Does change to build *.war help to faster deployment?
There are a few option to mitigate the roundtrip of building the jar file and upload it.
Hot-swap: For minor changes, you can hot-swap changes automatially when you have a remote-debugger attached. I use Intellij as Ide, which provide this out of the box after a file is recompiled, see more at this link how to enable it.
Reloading tool: use a tool that are designed to reload Java classes, such as JRebel which extends the classloader and updates a class if a change has been detected. However, they are often only available in a paid version.
Spring Boot dev-tools: this tool also monitors changes and restart the application with the new changes (so no need to rebuild the jar file). It is possible to use on a remote application. See this link for more info.
Using a war file is different concept since a war file is executed inside an application container (e.g a Wildfly server). You can dynamically upload a war file to a running application server, which will only restart the war file. But I'm not sure if this will lead to faster deployment, however it is a different approach how the application is run.

Bamboo task to update properties file before maven build

I am using spring-boot and would like to update the application.properties file in the /src/main/resources folder as a task within a manual build plan. As the service can be installed on premise at the customer, I want to build the jar for each customer, where I can provide variables (e.g. spring.data.mongodb.* properties) to be injected/overridden before the maven build.
I found the inject plugin, but this adds a prefix before the variables, which in this case wont work as the DB connection is done automatically with spring.
Is there another plugin I didn't find which could do the trick, or is there an easy way to script something like this (please provide an example as I am not very familiar with shell scripts)?

cannot find service.jar file custom portlet liferay

I am using liferay 6.2 & built a maven portlet and working fine, I want to use its tables to store data for another portlet so that I need its services in this portlet.
But we can't access it externally so i find a way something like: required-deployment-contexts=Portlet-Project1 inside liferay-plugin-package.properties, then found its works for Ant only.
I was also finding the xxx-portlet-service.jar but didn't able to, so that i could manually put it in other portlet's lib folder i.e inside tomcat-webapps-xxxportlet-WEB-INF.
Just want to find how to use xxxLocalService.util in other in maven portlet
The best approach you can implement is a plugin to manage all the interaction with the DB.
First of all you must create a Service with a maven project and include it into your pom.xml in each portlet that you need. Then you can invoke its methods whenever you want because each portlet will store the dependencies.
Create Service Plugin into jar file
Rebuild with mvn clean liferay:build-service
Custom your own methods to manage the iteraction with the DB (LocalServiceUtilImpl and rebuild).
Include this plugin into pom.xml portlets
Rebuild your portlet.
The JAR will be placed in your .m2 folder, then each time that you rebuild your Service Plugin will be updated.
If i understood your question correctly, You need to create service builder project using maven and then you can add as dependency in other project wherever you need access to use xxxLocalServicutil class.
You can follow below link to create maven service builder project.
http://www.liferay-guru.com/how-to-use-liferay-servicebuilder-archetype/
As you mentioned in your question.
was also finding the xxx-portlet-service.jar but didn't able to, so
that i could manually put it in other portlet's lib folder
To answer this, manually putting .jar file in lib directory will not help when you are working with maven project

where to place the external java jar when deploy birt report?

I use some java code to retrieve data from database, and export the java code as runnable jar, placed the jar in eclipse\plugins\org.eclipse.birt.report.viewer_3.7.1.v20110905\birt\scriptlib, then in the birt report I can use the jar to get the data. In eclipse all goes smoothly, I can see the correct data in preview.
but when I upload the myreport.rptdesign to the server, I don't know where to place the jar then the report can refer to it. In our team, they use grails to deploy birt report, all I need to do is upload the rptdesign file to a specified server directory, when there's no java jar to refer, that's enough. but when I need to refer to a java jar, I do not know how to deploy.
Please help and thanks a lot.
=========================================================
here is answer of my question. Just put the jar in directory lib of grails. It works!
Did you try to put the jar file in the server/lib directory? What kind of application server are you currently using?

Resources