To use this plugin, you need to declare a new PluginGroup. This is simply done by adding the following configuration into your ~/.m2/settings.xml
<pluginGroups>
<pluginGroup>net.labidi</pluginGroup>
</pluginGroups>
Then, depending on your own policy for repositories management, you'll have to declare a new pluginRepository, configure a server section and so forth. Generally, this should be transparent if running behind a Repository manager that proxies whatever remote repositories and alias them with a single in-hous URL. Personally, I'm using Nexus repository manager. Here is the repository URL:
http://maven.khaled-labidi.net/repo
This configuration is straight forward by adding the following into your POM's build/plugins section
<plugin>
<groupId>net.labidi</groupId>
<artifactId>jbpm-maven-plugin</artifactId>
<version>1.0.0</version>
</plugin>
If your project was generated using the JBPM archetype , the plugin should be working out-of-the-box.
If not, make sue your project satisfies the follwoing requirements:
<dependency>
<groupId>org.beanshell</groupId>
<artifactId>bsh</artifactId>
<version>2.0b4</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.0.8</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
(The JDBC dependency to use in the project depends of what's configured in your hibernate.cfg.xml)
The plugin comes with 3 goals : init,scan and deploy.
This goal serves just to initialize the plugin runtime execution. Normally, it should not be called manually. This goal runs the process-resources phase before it executes.
This goal scans for JBPM process archives in your project. It just displays the available process definitions depending on the plugin configuration (see below) .This goal runs the jbpm:init goal before it executes.
This goal deploys the scanned process archives to your JBPM database. This goal runs the jbpm:scan goal before it executes.
From within a jbpm project, just type
jbpm:deploy
Here is an output sample of a process deployment :
D:\workspace\test-jbpm-x>mvn jbpm:deploy
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'jbpm'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - com.site:test-jbpm-x:jar:2-SNAPSHOT
[INFO] task-segment: [jbpm:deploy]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing jbpm:deploy
[INFO] Preparing jbpm:scan
[INFO] Preparing jbpm:init
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [jbpm:init]
[INFO] Starting plugin init...
[INFO]
Plugin parameter excludes = [Ljava.lang.String;@39ab89
Plugin parameter fullArchive = true
Plugin parameter stopOnFail = true
Plugin parameter jpdlBaseDir = D:\workspace\test-jbpm-x/src/main/jpdl
[INFO] Plugin init OK
[INFO] [jbpm:scan]
[INFO] Starting scan of D:\workspace\test-jbpm-x/src/main/jpdl
14:44:25,390 [main] INFO JbpmConfiguration : using jbpm configuration resource 'jbpm.cfg.xml'
14:44:25,390 [main] DEBUG JbpmConfiguration : loading defaults in jbpm configuration
14:44:25,421 [main] DEBUG ObjectFactoryImpl : adding object info 'default.jbpm.context'
14:44:25,421 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.hibernate.cfg.xml'
14:44:25,421 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.business.calendar'
14:44:25,421 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.default.modules'
14:44:25,421 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.converter'
14:44:25,437 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.action.types'
14:44:25,437 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.node.types'
14:44:25,437 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.parsers'
14:44:25,437 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.varmapping'
14:44:25,437 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.mail.templates'
14:44:25,437 [main] DEBUG ObjectFactoryImpl : adding object info 'jbpm.byte.block.size'
14:44:25,437 [main] DEBUG ObjectFactoryImpl : adding object info 'jbpm.task.instance.factory'
14:44:25,437 [main] DEBUG ObjectFactoryImpl : adding object info 'jbpm.variable.resolver'
14:44:25,437 [main] DEBUG ObjectFactoryImpl : adding object info 'jbpm.mail.smtp.host'
14:44:25,437 [main] DEBUG ObjectFactoryImpl : adding object info 'jbpm.mail.address.resolver'
14:44:25,453 [main] DEBUG ObjectFactoryImpl : adding object info 'jbpm.mail.from.address'
14:44:25,453 [main] DEBUG ObjectFactoryImpl : adding object info 'jbpm.job.executor'
14:44:25,453 [main] DEBUG JbpmConfiguration : loading specific configuration...
14:44:25,453 [main] DEBUG ObjectFactoryImpl : adding object info 'jbpmConfiguration'
14:44:25,453 [main] INFO StaleObjectLogConfigurer : stale object exceptions will be hidden from logging
14:44:25,515 [main] DEBUG JpdlParser$JpdlEntityResolver : resolving schema reference publicId(null) systemId(http://jbpm.org/jpdl-3.2.xsd)
14:44:25,515 [main] DEBUG JpdlParser$JpdlEntityResolver : providing input source to local 'jpdl-3.2.xsd' resource
14:44:25,625 [main] DEBUG NodeTypes : node 'page' will not be available. class 'org.jboss.seam.pageflow.Page' couldn't be loaded
14:44:25,640 [main] DEBUG NodeTypes : node 'start-page' will not be available. class 'org.jboss.seam.pageflow.Page' couldn't be loaded
14:44:25,671 [main] DEBUG JpdlParser$JpdlEntityResolver : resolving schema reference publicId(null) systemId(http://jbpm.org/jpdl-3.2.xsd)
14:44:25,671 [main] DEBUG JpdlParser$JpdlEntityResolver : providing input source to local 'jpdl-3.2.xsd' resource
14:44:25,718 [main] DEBUG FileDefinition : preparing file 'processdefinition.xml' for storage in the database
14:44:25,718 [main] DEBUG FileDefinition : preparing file 'processimage.jpg' for storage in the database
14:44:25,718 [main] DEBUG FileDefinition : preparing file 'gpd.xml' for storage in the database
[INFO] Scanned process : Process : simple
XML = D:\workspace\test-jbpm-x\src\main\jpdl\simple.bp\processdefinition.xml
GPD = D:\workspace\test-jbpm-x\src\main\jpdl\simple.bp\gpd.xml
IMG = D:\workspace\test-jbpm-x\src\main\jpdl\simple.bp\processimage.jpg
[INFO] [jbpm:deploy]
[INFO] Deploying process simple ...
(...)
(a lot of logs statement : tweak your log4j.xml as needed ;-))
(...)
[INFO] Process simple deployed OK
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8 seconds
[INFO] Finished at: Fri Oct 03 14:44:31 AFT 2008
[INFO] Final Memory: 9M/18M
[INFO] ------------------------------------------------------------------------
| Name | Type | Since | Description | default |
| jpdlBaseDir | String | - | JBPM Processes root within the project | src/main/jpdl |
| fullArchive | Boolean | - | If false, the plugin will ignore archives not having the 3 files processdefinition.xml, gpd.xml and processimage.xml | true |
| stopOnFail | Boolean | - | Stop all process deployment if an error occurs | true |
| excludes | List | - | List of <exclude>Archive name</exclude> elements to skip during deployment | - |
sample configuration:
<jpdlBaseDir>src/main/jpdl/sub-dir</jpdlBaseDir>
<fullArchive>false</fullArchive>
<excludes>
<exclude>testProcess</exclude>
<exclude>simple.bp</exclude>
</excludes>
<stopOnFail>true</stopOnFail>