Adding custom code to "Build & Deploy" button in KIE workbench

716 views
Skip to first unread message

afs...@yahoo.com

unread,
Jul 10, 2015, 3:17:18 AM7/10/15
to drools...@googlegroups.com

Hello


I would like to add custom code to the "Build & Deploy" button in KIE Workbench under Project Authoring -> Tools -> Project Editor.

I need to run my own maven commands when the button is clicked instead of what it regularly does. Is this possible if I modify the source?

Also I need to add a radio button in that tool bar.

Can anyone provide insight on which project I would need to modify for this and which HTML page?


Thank you,

Afshad

Michael Anstis

unread,
Jul 10, 2015, 4:27:16 AM7/10/15
to drools...@googlegroups.com
KIE Workbench is written with GWT; so you're not going to find an HTML page for the Project Editor nor a JS fragment for it..

The Project Editor source code is however here. Search for "buildOptions" and you'll see how the "Build & Deploy" button is created and configured etc. 

You'll be able to use MenuFactory.newTopLevelCustomMenu() to add a RadioButton to the menu bar. See here for an example.

You'll need to recompile kie-wb-common and kie-wb-distributions for any changes you make to be included in the WAR (as a GWT re-compilation is required).

The workbench makes extensive use of the Uberfire framework. Have a read to help better understand the code.

Uberfire is written and maintained by the same developers as KIE Workbench.

With kind regards,

Mike 

--
You received this message because you are subscribed to the Google Groups "Drools Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage...@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/fd035ab8-2cb7-48b7-889b-b2b89779ba85%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

afs...@yahoo.com

unread,
Jul 12, 2015, 9:20:28 PM7/12/15
to drools...@googlegroups.com
Thanks for the response Michael
In my WAR there was no kie-wb-common-project-editor-client-6.1.0.Final.jar so I downloaded the war made my changes (simple change of changing menu text to "Test" instead of "Build & Deploy") built it and added it to the war but it did not seem to take any effect. My original war did not even contain this jar so I dont know how its working without it.
Also what is the kie-wb-distributions you are talking about? My existing war does not have any such jar. Why would it need to be recompiled as well if no changes are being made to it?
Thank you. Appreciate your help.

Michael Anstis

unread,
Jul 13, 2015, 5:29:00 AM7/13/15
to drools...@googlegroups.com
GWT applications require a recompilation of the "client side" source code to regenerate the JavaScript.

All Workbench related JARs named *-client*.jar are only used during the GWT compilation phase and not included in the WAR (as it is not needed one the Java Script has been generated).

Unless you compile your modified kie-wb-common JAR **AND** kie-wb-distributions any changes you make elsewhere will not be not be evident in the webapp.

kie-wb-distributions is the modules that produce the WARs. 


afs...@yahoo.com

unread,
Jul 14, 2015, 2:09:44 AM7/14/15
to drools...@googlegroups.com
Thank you Michael. I was able to build kie-wb-common. However while building kie-wb-distributions from either eclipse/command line/IDEA i get the classpath too long error. I googled about this but everyone has run into the same issue and no solution. I only have windows. With IDEA i tried starting with idea.dynamic.classpath=false
but that didnt work either i get the error below. Is there any other property i should be setting in idea.properties?

Information:Internal caches are corrupted or have outdated format, forcing project rebuild: GWT in module 'kie-wb-webapp': java.io.IOException: Cannot run program "C:/Program Files/Java/jdk1.6.0_45/bin/java" (in directory "C:\Users\afshad.dinshaw\.IntelliJIdea14\system\compile-server\kie-wb-distributions-6_1_0_final_54fb3ed9\targets\gwt\kie-wb-webapp\gwt-output"): CreateProcess error=206, The filename or extension is too long
Information:Using javac 1.6.0_45 to compile java sources
Information:java: Note: C:\Projects\CenturyLink\KIE-DISTRIBUTION\kie-wb-distributions-6.1.0.Final\kie-wb-distributions-6.1.0.Final\kie-wb\kie-wb-webapp\src\main\java\org\kie\workbench\backend\ApplicationScopedProducer.java uses unchecked or unsafe operations.
Information:java: Note: Recompile with -Xlint:unchecked for details.
Information:7/14/2015 1:05 AM - Compilation completed with 1 error and 1 warning in 35s 712ms
Error:Internal error: (java.io.IOException) Cannot run program "C:/Program Files/Java/jdk1.6.0_45/bin/java" (in directory "C:\Users\afshad.dinshaw\.IntelliJIdea14\system\compile-server\kie-wb-distributions-6_1_0_final_54fb3ed9\targets\gwt\kie-wb-webapp\gwt-output"): CreateProcess error=206, The filename or extension is too long
java.io.IOException: Cannot run program "C:/Program Files/Java/jdk1.6.0_45/bin/java" (in directory "C:\Users\afshad.dinshaw\.IntelliJIdea14\system\compile-server\kie-wb-distributions-6_1_0_final_54fb3ed9\targets\gwt\kie-wb-webapp\gwt-output"): CreateProcess error=206, The filename or extension is too long
at java.lang.ProcessBuilder.start(ProcessBuilder.java:470)
at org.jetbrains.jps.gwt.build.GwtBuilder.compile(GwtBuilder.java:169)
at org.jetbrains.jps.gwt.build.GwtBuilder.build(GwtBuilder.java:101)
at org.jetbrains.jps.gwt.build.GwtBuilder.build(GwtBuilder.java:48)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildTarget(IncProjectBuilder.java:906)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:887)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:945)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:840)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:663)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:370)
at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:191)
at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:137)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:293)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:124)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run(BuildMain.java:242)
at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:41)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.io.IOException: CreateProcess error=206, The filename or extension is too long
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:177)
at java.lang.ProcessImpl.start(ProcessImpl.java:28)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
... 21 more
Warning:Output path C:\Projects\CenturyLink\KIE-DISTRIBUTION\kie-wb-distributions-6.1.0.Final\kie-wb-distributions-6.1.0.Final\kie-wb\kie-wb-webapp\target\generated-sources\annotations intersects with a source root. Only files that were created by build will be cleaned.

Michael Anstis

unread,
Jul 14, 2015, 6:17:31 AM7/14/15
to drools...@googlegroups.com
Yes, sadly it is a well known limitation of Windows :(


InteliJ uses the "Use a special class loader which reads the classpath from a config file" approach when - as far as I know - the "idea.dynamic.classpath" flag is true.

afs...@yahoo.com

unread,
Jul 15, 2015, 10:32:15 PM7/15/15
to drools...@googlegroups.com
Hello Michael
So we are building on linux however  it does not seem to be generating anything but a test jar in each of the folders and subfolders. Is this normal or should it be generating something else? I am using the command "mvn clean install" in the room of kie-wb-common. 
For example this is what is see in each of the target directories: kie-wb-common-6.1.0.Final-tests.jar
Also after building kie-wb-common, we have to build kie-wb-distribution and that will generate a war file?

Thanks for your help.

Michael Anstis

unread,
Jul 16, 2015, 4:45:50 AM7/16/15
to drools...@googlegroups.com
If you do this you should build the necessary WARs:
  1. cd ./kie-wb-common
  2. mvn clean install
  3. cd ../kie-wb-distributions
  4. mvn clean install
The WARs will be in the following:
  • ./kie-wb-distributions/kie-drools-wb/kie-drools-wb-distribution-wars/target
  • ./kie-wb-distributions/kie-wb/kie-wb-distribution-wars/target
We follow this exact procedure whenever we build the application.

With kind regards,

Mike

tar...@valyoo.in

unread,
Jan 29, 2016, 3:10:15 AM1/29/16
to Drools Usage
Hi Eddy,

were you able to add additional maven commands to execute. I have a similar requirement. Could you please share what you did?

Thanks,
Tarun

Toni Rikkola

unread,
Jan 29, 2016, 7:54:11 AM1/29/16
to Drools Usage
If you end up making something reusable the Guvnor project is happy to take pull requests :)

Something that possibly digs the command out of the pom.xml and let's the user select what he does. This doesn't necessary make it into the KIE workbench, but Guvnor is used by much more than KIE/Drools/JBPM.

ravi pillala

unread,
Jul 17, 2016, 11:36:14 PM7/17/16
to Drools Usage
Hi Afshad,

I have the same requirements as what you described. Can you share what you have done or provide the git links if you commit your changes.

Thanks
Ravi

Afshad Dinshaw

unread,
Jul 18, 2016, 12:31:54 AM7/18/16
to drools...@googlegroups.com
It was a very long and I don't remember we did not do anything about it. 
--
You received this message because you are subscribed to a topic in the Google Groups "Drools Usage" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/drools-usage/iHXWzvH1WJQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to drools-usage...@googlegroups.com.

To post to this group, send email to drools...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages