How one can integrate Activiti Modeler into their own web application and keep all the advantages Maven suggests?
The probem is that Activiti Modeler in Maven is par
I have managed to do this using Maven overlay feature:
1) include overlay of Explorer web app, but include only the Modeler files:
pom.xml:
org.activiti
activiti-webapp-explorer2
${activiti-version}
war
compile
....
org.apache.maven.plugins
maven-war-plugin
2.6
org.activiti
activiti-webapp-explorer2
WEB-INF/classes/stencilset.json
editor-app/**
modeler.html
2) add modeler Spring resources. They are used to retrieve and to save models (note: not process definitions, it's kinda different thing) and also to serve the stencilset:
org.activiti
activiti-modeler
${activiti-version}
3) that would be it but it won't actually work in your application unless it is called "activiti-explorer". Add a file to your project called "editor-app/app-cfg.js", and add the following content there:
editor-app/app-cfg.js:
'use strict';
var ACTIVITI = ACTIVITI || {};
ACTIVITI.CONFIG = {
'contextRoot' : window.location.pathname.substring(0,window.location.pathname.lastIndexOf('/')),
};
This is actually a copy of the native app-cfg, which contains the strange "/activiti-explorer/service" setting for context root. We change it to more generic setting. It will be used to retrieve models from the repository. Our file will overlay the one that ships with explorer webapp.
Notes:
a) you have to manage conversion of process definitions to models by yourselves. For an idea, see https://github.com/Activiti/Activiti/blob/activiti-5.19.0.1/modules/activiti-explorer/src/main/java/org/activiti/editor/ui/ConvertProcessDefinitionPopupWindow.java
b) I had to avoid using one Jackson Object Mapper for everything, I haven't research why this didn't work:
Don't do this or research more, as this actually breaks the stencilcet resurce serving part of the "activiti-modeler". It starts serving stencilset as a malformed string instead normal json.
c) I had no idea how to inject CSRF security headers in the Modeler saving function, so I switched it off - if you don't use Spring Security, discard this