Maven Plugin

The Maven project-build-plugin makes automated continuous deployment to an Axon Ivy Engine possible. The Maven plugin can deploy projects file based or via HTTP. The file based mechanism is the default.

For the file based deployment the deployment folder must be available on the same machine on which the build is executed. You may use Windows-Shares or SMB-Configurations.

On the other hand the HTTP deployment is based on the REST API service of the Axon Ivy Engine. For the deployment you need the credentials of an administrator.

Command line deployment

The deploy-to-engine goal can be execute on the command line. The following two examples deploys the project myProject.iar to the application portal of the Axon Ivy Engine.

#  file based deployment to c:/axonivy/engine
mvn com.axonivy.ivy.ci:project-build-plugin:7.4.0-SNAPSHOT:deploy-to-engine \
  -Divy.deploy.file=myProject.iar \
  -Divy.deploy.engine.dir=c:/axonviy/engine \
  -Divy.deploy.engine.app=portal
# http based deployment to http://localhost:8080/
# default credentials admin/admin used for demo engine
mvn com.axonivy.ivy.ci:project-build-plugin:7.4.0-SNAPSHOT:deploy-to-engine \
  -Divy.deploy.file=myProject.iar \
  -Divy.deploy.method=HTTP \
  -Divy.deploy.engine.url=http://localhost:8080/ \
  -Divy.deploy.engine.app=portal

Goal execution with POM

The deploy-to-engine goal can also be executed with a given pom.xml file. The configuration where to deploy the project can then be configured in the pom.xml.

The following pom.xml snippet deploys the current project to the application portal of the Axon Ivy Engine at c:/axonivy/engine.

1<plugin>
2  <groupId>com.axonivy.ivy.ci</groupId>
3  <artifactId>project-build-plugin</artifactId>
4  <extensions>true</extensions>
5  <configuration>
6    <deployToEngineApplication>Portal</deployToEngineApplication>
7    <deployEngineDirectory>c:/axonivy/engine</deployEngineDirectory>
8  </configuration>
9</plugin>

Execute the deploy-to-engine goal in the directory where the pom.xml file is located:

mvn ivy:deploy-to-engine

The next example deploys the current project to the application portal to an Axon Ivy Engine which is accessible at http://localhost:8080. You need to configure the credentials of an administrator user in the maven settings.xml file. Your custom defined serverId must match with deployServerId.

 1<plugin>
 2  <groupId>com.axonivy.ivy.ci</groupId>
 3  <artifactId>project-build-plugin</artifactId>
 4  <extensions>true</extensions>
 5  <configuration>
 6    <deployToEngineApplication>portal</deployToEngineApplication>
 7    <deployMethod>HTTP</deployMethod>
 8    <deployServerId>serverId</deployServerId>
 9    <deployEngineUrl>http://localhost:8080/</deployEngineUrl>
10  </configuration>
11</plugin>
 1<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
 2  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 3  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
 4  <servers>
 5    <server>
 6      <id>serverId</id>
 7      <username>admin</username>
 8      <password>admin</password>
 9    </server>
10  </servers>
11</settings>

Bind to Maven Lifecycle

To deploy an ivy-archive (IAR) during it’s maven build lifecycle, configure an execution which binds the deploy-to-engine goal to a lifecycle phase.

 1<plugin>
 2  <groupId>com.axonivy.ivy.ci</groupId>
 3  <artifactId>project-build-plugin</artifactId>
 4  <extensions>true</extensions>
 5  <configuration>
 6    <deployToEngineApplication>Portal</deployToEngineApplication>
 7    <deployEngineDirectory>c:/axonivy/engine</deployEngineDirectory>
 8  </configuration>
 9  <executions>
10    <execution>
11      <id>deploy.to.engine</id>
12      <goals><goal>deploy-to-engine</goal></goals>
13      <!-- Bind goal to maven site-deploy phase -->
14      <phase>site-deploy</phase> 
15    </execution>
16  </executions>
17</plugin>

Execute the maven lifecycle in the directory where the pom.xml file is located:

mvn site-deploy

Further examples are documented on GitHub in the project-build-examples repository.