activiti:start

Activiti Hacking Notes

https://hub.alfresco.com/t5/alfresco-process-services/javascript-in-activiti-with-openjdk-11/m-p/305301/highlight/true#M7133

First, get the rhino-jdk8.zip from https://github.com/zeroboo/java-scripting-rhino-jdk8/releases/tag/v1.0.0 . It contains js.jar and js-engine.jar. Ignore the js.jar as it is readily available in maven central.

Include the js-engine.jar in the project files for easy reference. Use maven-install-plugin to install the js-engine.jar to local repository.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-install-plugin</artifactId>
    <version>2.4</version>
    <executions>
        <execution>
            <id>1</id>
            <phase>initialize</phase>
            <goals>
                <goal>install-file</goal>
            </goals>
            <configuration>
                <groupId>org.mozilla</groupId>
                <artifactId>rhino-js-engine</artifactId>
                <version>1.0</version>
                <packaging>jar</packaging>
                <file>${basedir}/lib/js-engine.jar</file>
            </configuration>
        </execution>
    </executions>
</plugin>			

Then add the following maven dependencies to our application

<!-- this coming from maven central -->
<dependency>
    <groupId>org.mozilla</groupId>
    <artifactId>rhino</artifactId>
    <version>1.7.13</version>
</dependency>	
		
<!--  this coming from local repository -->	
<dependency>
    <groupId>org.mozilla</groupId>
    <artifactId>rhino-js-engine</artifactId>
    <version>1.0</version>
</dependency>

Execute:

mvn initialize

This is a one time execution. Once the js-engine.jar installed in local repository, no need to initialize again. Then build and run as usual. All javascript in ScriptExecutionListener will be executed under Rhino.

  • activiti/start.txt
  • Last modified: 2021/02/26 21:19
  • by jmerari