cancel
Showing results for 
Search instead for 
Did you mean: 

Create and deploy PAR using Maven only

wesley
Champ in-the-making
Champ in-the-making
The Activiti 5.6 User Guide shows how to deploy PAR into Activiti process engine using Ant. Here is what I have used to do it without a build.xml file using maven plugins:


            <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>
2 REPLIES 2

frederikherema1
Star Contributor
Star Contributor
Thanks for sharing!

Not applicable
According to the current bar file schema:
<code>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
  <execution>
   <id>create-par</id>
   <phase>package</phase>
   <goals>
    <goal>run</goal>
   </goals>
   <configuration>
    <target>
     <mkdir dir="${project.build.directory}/bar"/>
     <!– BPMN files –>
     <copy todir="${project.build.directory}/bar">
      <fileset dir="src/main/bpmn"/>
      <mapper type="glob" from="*.bpmn" to="*.bpmn20.xml" />
     </copy>
     <!– PNG files –>
     <copy todir="${project.build.directory}/bar">
      <fileset dir="src/main/bpmn">
       <include name="**/*.png"/>
      </fileset>
     </copy>
     <echo message="Creating ${project.build.directory}/${project.artifactId}-${project.version}.bar" />
     <zip destfile="${project.build.directory}/${project.artifactId}-${project.version}.bar">
      <fileset dir="${project.build.directory}/bar" />
     </zip>
    </target>
   </configuration>
  </execution>
</executions>
</plugin>
</code>