问题
I am using Eclipse Luna and WildFly 8.1 with JBPM 6.2. Currently, my Eclipse is configured so that I can start both the WildFly 8.1 server and the KIE workbench directly from within Eclipse.
Previously, I had created an Evaluation.bpmn
workflow from the KIE workbench and was able to succesfully deploy it and see the workflow logs in the database tables.
However, is there a way to create a JBPM project in Eclipse and deploy and start the workflow directly from Eclipse? If so, how can I do it?
回答1:
This isn't deploying from eclipse. The best way is:
- Create a m2e project mentioned by @jl987
- Create a junit test
- In junit before class, use the jbpm rest api to deploy your maven artifact
In junit test method execute and validate results of workflow with rest api.
The rest api can be found at: API
There is also a maven rest client in kie-remote: Client
回答2:
Another way to access and modify projects from the workbench is to clone the built-in Git repository.
There are a couple of different ways to go about it, but I'm going to describe the one that is most useful for a BPM server with many projects that you might want to work with or not, but want to have locally just in case.
The alternative methods are quite similar as the main concept is to clone a project from KIE Workbench locally and import it into Eclipse.
First, get some info from KIE workbench:
In the workbench, go to
Authoring
->Administration
menu, and if not displayed by default, click onRepositories
->List
in the menu bar below that.Locate the repository containing your project and click the desired access protocol link in the
General Information
pane on the right hand side (ssh will probably work best).Copy the repository URI to clipboard.
Next, clone the Git repository and import it as a general project:
In Eclipse (or JBoss Developer Studio), create a clone of that Git repository by selecting
File
->Import
->Git
->Projects from Git
and clickNext
.In repository selection dialog, select
Clone URI
and clickNext
.In
Source Git Repository
dialog, paste the URI you copied from the workbench and enter your workbench username and password, then clickNext
.Confirm the host key and select the branch(es) you want to clone (probably just
master
). ClickNext
.Select a place you want to clone the Git repository to and click
Next
. (It does not have to be in your workspace, but you will be working directly on that copy, so place it somewhere where you keep your projects.)In the import wizard selection dialog, select
Import as a general project
, clickNext
and give it a name, for example "My KIE repository". ClickFinish
.
Finally, just import an existing Maven project from that clone:
Select
File
->Import
->Maven
->Existing Maven Projects
and clickNext
.In the
Maven Projects
dialog, clickBrowse
and point it to the location of the project inside your cloned Git repository.Make sure a
pom.xml
is displayed, with the project coordinates describing the group ID, the artifact ID and the version of the project you want to import and work on.Click
Finish
.
If your maven repositories are configured correctly, that should be it.
You might have to add an external repository where org.kie:kie-maven-plugin
can be found, because the packaging of KIE Workbench projects is set to kjar
, which is implemented by that build plugin.
Afterwards, just work on that project as if it were any normal Maven project. Test it in your workspace, manipulate process diagrams, whatever. Whenever you want to publish it in the KIE server, just right-click it and select Team
-> Push to Upstream
.
If you want to refresh your project with any changes that might have happened in KIE Workbench in the mean time, do the opposite, Team
-> Fetch from Upstream
.
Of course, pushing the changes to origin will not automatically build and deploy the project, for that you still have to log in and do it manually, or do it using the REST api.
回答3:
To deploy a workflow directly from Eclipse, first create a JBPM Maven project within Eclipse. Perform "mvn install" on a command line or through the Eclipse m2e plugin.
Now go to your KIE workbench. Select "Deploy" tab, "Process Deployments," and click the plus sign on the left. Fill out the Group ID, Artifact, and Version. Click "Deploy Unit".
来源:https://stackoverflow.com/questions/29130841/jbpm-6-2-how-to-deploy-a-workflow-directly-from-eclipse-instead-of-kie-workbenc