Tuesday, May 21, 2013

Activiti create and deploy JAR and BAR using Maven only

In a maven multimodule project, to deploy all the services with maven, we need a way to generate for our custom activiti project .jar and .bar files. As reported in http://forums.activiti.org/content/create-and-deploy-par-using-maven-only add
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.3</version>
                <executions>
                    <execution>
                        <id>create-par</id>
                        <phase>package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <echo message="Creating bar: ${project.build.directory}/process-definitions-${project.version}.bar"/>
                                <zip destfile="${project.build.directory}/process-definitions-${project.version}.bar">
                                    <fileset dir="src/main/process">
                                        <include name="**/*.bpmn20.xml"/>
                                        <include name="**/*.form"/>
                                    </fileset>
                                </zip>
                            </tasks>
                        </configuration>
                    </execution>
                    <execution>
                        <id>deploy-par</id>
                        <phase>install</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <echo message="Deploying bar"/>
                                <taskdef name="deploy-bar" classname="org.activiti.engine.impl.ant.DeployBarTask" classpathref="maven.runtime.classpath"/>
                                <deploy-bar file="${project.build.directory}/process-definitions-${project.version}.bar"/>
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
in the project pom.