Automation Process Project structure
Automation Process Project structure
Dependencies
All stuff you need to use during development process are coming together with Control Server installation in onboard nexus:
Nexus URL
https://<CS URL>/nexus/#browse/browse:rpaplatform
Project generation
Project can be generated from archetype using either CLI or IDE.
CLI
The following command creates a project from archetype:
mvn archetype:generate -DarchetypeGroupId=eu.ibagroup -DarchetypeArtifactId=easy-rpa-ap-archetype -DarchetypeVersion=2.4.0-SNAPSHOT -DgroupId=org.test -DartifactId=sample -Dversion=1.0-SNAPSHOT
As a result the stub project for org.test:1.0-SNAPSHOT will be generated
IDE
First, add remote catalog with archetype easy-rpa-ap-archetype in your IDE
Second, use the sequence "New project → Maven project", then choose easy-rpa-ap-archetype as the base archetype to generate project from.
Project structure
The generated project for abstract Automation Process is usual maven project with additional folder:
The folder package contains definition of artifacts that need to be added into AutomationProcess package - the result of maven project deploy goal. That you can use the generated package to import into a EasyRPA Control Server.
Folder | Content | Definition | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
automationProcess (or ap for old releases) | Automation Processes to add into result package. | Contains a set of the following files per Automation process, the files with the same AP should have the same name, but different extensions.
* For every defined Automation Process, export plugin try to add a corresponding jar into result package lib folder with AP class definition. If all AP in the same project, will be only one jar. If you want to add additional jar(s) into package you can specify what to add in the projects pom in pluginin section: <build> <plugins> <plugin> <groupId>eu.ibagroup</groupId> <artifactId>easy-rpa-ap-export-plugin</artifactId> <configuration> <groupId>${project.groupId}|eu.ibagroup|eu.ibagroup.samples.system|eu.ibagroup.samples</groupId> <artifactId>easy-rpa-dp-ap|easy-rpa-cldp-ap|easy-rpa-iedp-ap|easy-rpa-aps|easy-rpa-idp-ap|easy-rpa-invoiceplane-system|easy-rpa-invoiceplane</artifactId> </configuration> </plugin> </plugins> </build> where groupId/artifactId are regexp string. The plugin add additional libs from project dependencies scope of all artifact that has corresponding groupId/artifactId | ||||||||||||
dataStore (or datastore for old releases) | Data Stores to add into result package. | Contains a set of the following files per DataStore, the files with the same DS should have the same name, but different extensions.
| ||||||||||||
documentSet (or docset for old releases) | Document Sets to add into result package. | Contains a set of the following files per DocumentSet, the files with the same DS should have the same name, but different extensions.
| ||||||||||||
documentType (or dt for old releases) | Document Types to add into result package. | Contains one file per DocumentType.
| ||||||||||||
model | Models to add into result package. | Contains a set of the following files per Model, the files with the same model should have the same name, but different extensions.
| ||||||||||||
humanTaskType (or htt for old releases) | Human Task Type to add into result package. | Contains a set of the following files per Human Task Type, the files with the same HTT should have the same name, but different extensions.
| ||||||||||||
secretVault (or secret for old releases) | Secret Vault entries to add into result package. | Contains one vault.properties file for all secrets or one file per Secret entry. In case if the vault.properties exists, the json files will be skipped.
| ||||||||||||
storage | Files to add into EasyRPA storage. | The directory should contains at least one level folder that is mapped to a bucket. i.e. the following structure will add all pdf files into folder idp_sample of the bucket data: | ||||||||||||
package.json | Automation Package format mark file. | Empty JSON | ||||||||||||
src/main/resources/usecase.properties | Data Store name runtime rendering pattern and default use case properties that relates to a specific Use Case implemented | Mandatory 'uc_resource_name_pattern' property:
Optional default properties of use case:
|
Please, note, that only OVERRIDE and SKIP strategies can be applied to .jar, document set, model and secret vault entities. Be careful when using the OVERRIDE strategy for the previously mentioned entities. Even if an error occurs during the import process, the changes cannot be rolled back and the data in the bucket will be lost for the .jar, document set, model and secret vault if the OVERRIDE strategy was applied to them.
Package building
The following command will build the project and create a zip-package with all needed files including jar.
mvn clean package
The zip file of project will be generated and put into target directory
Package importing
There are three ways to import package into control server:
- Deploy on Control Server manually
- Upload AP zip package
- AP Export maven plugin
Deploy on Control Server manually
Deploy AP jar on easyRPA nexus.
Set easy-rpa-nexus repository credentials in your maven settings.xml, see above.
Set-up nexus repository URL in distributionManagement section of your project pom file:
<distributionManagement> <repository> <id>easy-rpa-nexus</id> <url>https://<easy-rpa-host>/nexus/repository/aps/</url> </repository> <snapshotRepository> <id>easy-rpa-nexus</id> <url>https://<easy-rpa-host>/nexus/repository/aps/</url> </snapshotRepository> </distributionManagement>
Run maven deploy:
mvn clean deploy
Then go to control server and define your AP, Secrets, Datastores:
Upload AP zip package with Contrlol Server UI
- Navigate to page Automation Process → Upload package
- Choose the zip file to upload
- Click Upload.
Control server will respond with report about operations it has done and their status. UI for package upload is using ADD mode by default which results in creation of records which did not exist before and fail in opposite case.
There are two possible scenarios:
1) There are no errors, and all components have been successfully created (no further actions required)
2) There are errors - some components failed due to conflicts with existing ones with the same name. In this case review the errors and choose different strategy to merge this components, such as OVERRIDE or SKIP. Press Upload button to perform upload operation once again.
Note, that the upload operation internally consists from two independent transactions - CS update and upload of jar file to Nexus. Upload to Nexus is not rolled back due to nexus limitations.
AP Export with maven plugin
The cs-upload profile can be used for CI/CD builds. It contains maven-assembly-plugin that uploads the generated package to CS.
To use plugin for automatical Ap package upload on Control Server, you need to set path to development configuration file - cs.json:
<build> <plugins> <plugin> <groupId>eu.ibagroup</groupId> <artifactId>easy-rpa-ap-export-plugin</artifactId> <version>2.4.0-SNAPSHOT</version> <configuration> <config>c:\work\cs.json</config> </configuration> </plugin> </plugins> </build>
And run the following command that will build the project, create a zip-package and upload it into CS the development configuration you specified:
mvn clean package deploy -Pcs-upload
Note, that plugin is using importStrategy defined in package for automatic conflict resolving.
AP Standalone Run
The standalone-jar maven profile (included into artefactory-generated pom by default) can be used for generating standalone self-executable jar will all needed dependencies and resources included. It contains maven-shade-plugin that resolve all AP dependencies and combines them into single executable Jar, plus it include apm_run.properties and vault.properties from test resources.
Below is profile snippet that can be included into an existing AP module pom.xml:
<profile> <!-- use this profile to generate standalone executable jar with the ap --> <id>standalone-jar</id> <dependencies> <dependency> <groupId>eu.ibagroup</groupId> <artifactId>easy-rpa-engine</artifactId> <scope>compile</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <executions> <execution> <goals> <goal>shade</goal> </goals> <configuration> <shadedArtifactAttached>true</shadedArtifactAttached> <shadedClassifierName>full</shadedClassifierName> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <mainClass>eu.ibagroup.easyrpa.engine.boot.ApModuleRunner</mainClass> </transformer> <transformer implementation="org.atteo.classindex.ClassIndexTransformer" /> <transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer"> <resource>vault.properties</resource> <file>src\test\resources\vault.properties</file> </transformer> <transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer"> <resource>apm_run.properties</resource> <file> src\test\resources\apm_run.properties</file> </transformer> </transformers> <filters> <filter> <artifact>eu.ibagroup:easy-rpa-engine-api</artifact> <excludes> <exclude>eu/ibagroup/easyrpa/engine/apflow/DevelopmentApModule.class</exclude> </excludes> </filter> <filter> <artifact>*:*</artifact> <excludes> <exclude>module-info.class</exclude> <exclude>META-INF/*.SF</exclude> <exclude>META-INF/*.DSA</exclude> <exclude>META-INF/*.RSA</exclude> </excludes> </filter> </filters> </configuration> </execution> </executions> <dependencies> <dependency> <groupId>org.atteo.classindex</groupId> <artifactId>classindex-transformer</artifactId> <version>3.13</version> </dependency> </dependencies> </plugin> </plugins> </build> </profile>
And run the following command that will build the project and create a standalone executable jar :
mvn clean package -Pstandalone-jar
Once uber jar generated it can be run with the command line like below:
java -jar sample-1.0-SNAPSHOT-standalone.jar
Please see Invoice Plane Automation Demo for an example.