How to Build and Run your first Command
1. What You Will Learn
After finishing this tutorial you will be able to write your own commands up to command groups, build them and integrate them into the PAK editor.
3. What is a Command?
A concrete implementation of a task. Commands are elements that are later displayed in the Construction Kit as part of the Palette in the editor.
4. Implementation
For the demonstration of the single steps in this tutorial the IDE IntelliJ is used. |
First open your selected IDE and create a new Gradle project with the following configuration:
By adding a sample code you will automatically get the desired folder structure |
Then replace the build.gradle file with the following code fragment:
Unresolved directive in PAK_Command_Build_Run_Guide.adoc – include::../../../../../src/PAKDeveloping/DevelopingThePAKConstructionKit/PAKCommandDeveloperGuide/Commands/JavaCommand/Code/buildAndRunGuideBuildGradle.adoc[]
You can verify the successful loading of build.gradle using the Gradle toolbar on the right side. This should look like this:
Now we come to the coding of the HelloWorld command. For that you just have to replace the main class with the following class:
Unresolved directive in PAK_Command_Build_Run_Guide.adoc – include::../../../../../src/PAKDeveloping/DevelopingThePAKConstructionKit/PAKCommandDeveloperGuide/Commands/JavaCommand/Code/buildAndRunGuideHelloWorld.adoc[]
Explanations about the individual annotations that can be used for command development can be found in the comments and in the PAK Command Developer Guide |
That’s all, our first command is implemented!
In order to use our new developed command we need to create jar out of it and publish it. (In our example we publish it to maven local)
5. Build a Bpmn Workflow
In order to use our new command in our workflow we need to setup the Commands Repositories for the PAK Editor app.
5.1. Setting Up the Commands
To do so open the menu Preferences
→ Repositories
Select the Folder Button
Select the .m2 folder of your users home and press the Add Button
Save the changes with the Save Changes Button
You can select any folder or directly the created jar-File. We are choosing this option just because we did so above. |
After adding the jar file you should be able to refresh the commands at the bottom left and see the following:
6. Next Steps
This guide covered the building and using a command in the PAK-editor. Now we are ready to run this workflow in our Application