Maven configuration
Companion for Delivery plugin configuration
To use Companion for Delivery plugin inside a maven project, you need to add plugin repository to your pom.xml:
<pluginRepositories>
<pluginRepository>
<id>nexus.cantor.public</id>
<name>Cantor Public Repository</name>
<url>https://ccs-nexus.cantor.fr/content/groups/public</url>
</pluginRepository>
</pluginRepositories>
The Companion for Delivery plugin can be defined as follows:
<plugin>
<groupId>fr.cantor.c4d</groupId>
<artifactId>c4d-maven-plugin</artifactId>
<version>${c4d-maven-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<companion>
<context>${step.context}</context> <!-- required -->
<workspace>${step.workspace}</workspace> <!-- required -->
<step>
<url>${step.url}</url>
<username>${step.username}</username>
<password>${step.password}</password>
<!-- <context/> default value : companion.context -->
<!--<workspace/> default value : companion.workspace -->
<!--<restApiVersion/> default value : v1 -->
<!--<autoInvoke/> default value : true. Value false is only compatible with REST API v1 -->
</step>
<sheet>
<csv>
<delimiter>;</delimiter> <!-- default value : ; -->
<quote>"</quote> <!-- default value : " -->
</csv>
<properties> <!-- all the properties here will be added to the step.xml generated from csv/xlsx -->
<SingleUpdateMode>Y</SingleUpdateMode>
<!-- <AutoApprove>Y</AutoApprove> -->
<!-- <ContextID></ContextID> default value : companion.context -->
<!--<WorkspaceID></WorkspaceID> default value : companion.workspace -->
</properties>
</sheet>
<properties><!-- all the properties here will be available in the params of companion.xml -->
<!-- <ContextID></ContextID> default value : companion.context -->
<!-- <WorkspaceID></WorkspaceID> default value : companion.workspace -->
</properties>
<includeModuleVersions>true</includeModuleVersions><!-- create object and attributes for each module to store version and build date -->
</companion>
<report>false</report>
</configuration>
</plugin>
TIP
We strongly recommend to use variable for step
information : step.context
, step.workspace
, step.url
, step.username
and step.password
to handle security and multiple environment like describe in Devops -> Maven configuration -> Profile Management
includeModuleVersions
This property allows Companion for Delivery to add an object containing two attributes per module. Both of these attributes will have the version and build date of the module.
This information is contained in the file resulting from the package and in the file transmitted during the deploy.
restApiVersion
This property allows to override STEP Rest Api version used to deploy and test.
Allowed values : v1 (default value), v2
autoInvoke
If set to false, this property indicates that IIEP auto invocation has been disabled on the STEP instance for the REST API V1.
AutoApprove
This property allows to automatically approve datas on deploy.
report
This property allows different goals to generate a json report that can be parsed to display readable messages.
Specify STEP version
Default version
Companion for Delivery version | STEP default version |
---|---|
< 5.0.0 | STEP 9.3 |
> 5.0.0 & < 5.0.3 | STEP 10.3.0 |
>= 5.0.3 | STEP 10.3.1 |
Change version
The STEP version used to compile and decompile can be overridden from the pom.xml
<plugin>
<groupId>fr.cantor.c4d</groupId>
<artifactId>c4d-maven-plugin</artifactId>
<version>${c4d-maven-plugin.version}</version>
<extensions>true</extensions>
<configuration>...</configuration>
<dependencies>
<dependency>
<groupId>fr.cantor.companion.ext</groupId>
<artifactId>stepxml-xsd</artifactId>
<version>11.1.0</version>
</dependency>
</dependencies>
</plugin>
To find the dependency's version corresponding to your STEP's version look at the following matrix:
STEP version | Dependency version |
---|---|
STEP 9.0 | 9.0.0 |
STEP 9.1 | 9.1.0 |
STEP 9.2 | 9.2.0 |
STEP 9.3 | 9.3.0 |
STEP 10.0 | 10.0.1 |
STEP 10.1 | 10.1.1 |
STEP 10.2 | 10.2.1 |
STEP 10.3 | 10.3.1 |
STEP 11.0 | 11.0.1 |
STEP 11.1 | 11.1.0 |
Profile management
To configure Companion for Delivery maven plugin, you need to define context
, workspace
, url
, username
and password
to reflect your configuration.
For this purpose we strongly recommend to use maven profile in the settings.xml file.
This solution hide the credentials on the developer's computer.
See more information on Maven introduction to profiles
Command line configuration
To generate a Companion for Delivery project or run a Companion for Delivery goal without project you need to configure a profile in settings.xml.
<profiles>
<profile>
<id>default</id>
<!-- optional -->
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<!-- mandatory -->
<repositories>
<repository>
<id>nexus.cantor.public</id>
<name>Cantor Public Repository</name>
<url>https://ccs-nexus.cantor.fr/content/groups/public</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus.cantor.public</id>
<name>Cantor Public Repository</name>
<url>https://ccs-nexus.cantor.fr/content/groups/public</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
TIP
If you don't activate a profile by default, you have to use -Pmy-profile-id in your command line.
Project configuration
It's possible to split the profile to put public information in pom.xml and private information in settings.xml using the same profile id:
pom.xml
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<step.context>GL</step.context>
<step.workspace>Main</step.workspace>
</properties>
</profile>
</profiles>
settings.xml
<profiles>
<profile>
<id>dev</id>
<properties>
<step.url>https://www.myserver.com/</step.url>
<step.username>my_username</step.username>
<step.password>my_password</step.password>
</properties>
</profile>
</profiles>
TIP
Following information step.url
, step.username
, step.password
are only needed for deployment and test.
Multiple environment
You can add multiple profile to build / deploy your Companion for Delivery project for multiple environments. To select the profile, you can specify it in maven command like that:
mvn -Pprofile
Companion for Delivery tests
Dependency
Companion for Delivery need a dependency to execute tests that you can get on Cantor repository and add on your pom.xml like that:
<repositories>
<repository>
<id>nexus.cantor.public</id>
<name>Cantor Public Repository</name>
<url>https://ccs-nexus.cantor.fr/content/groups/public</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>fr.cantor.c4d</groupId>
<artifactId>c4d-tests</artifactId>
<version>${c4d-maven-plugin.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Tests execution
To execute tests, you need to configure maven-failsafe-plugin
with test and environment information.
For that, you need to add this plugin to your maven build part:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<includes>
<include>integrationtests/**</include> <!-- Reference the integrationtests directory present in src/test/ -->
</includes>
<systemProperties> <!-- All the following informations come from profile -->
<step.url>${step.url}</step.url>
<step.username>${step.username}</step.username>
<step.password>${step.password}</step.password>
<step.context>${step.context}</step.context>
<step.workspace>${step.workspace}</step.workspace>
<!-- <step.rest.api.version>v2</step.rest.api.version> default value : v1 -->
<!-- <step.iep.autoinvoke>false</step.iep.autoinvoke> default value : true. Value false is only compatible with REST API v1-->
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>