Published on April 10, 2019 / Updated on May 22, 2020
UPDATE-[22-May-2020]: This plugin has been tested with ACE v11.0.0.7, Maven 3.6.0 and Jenkins 2.222.3 on CentOS and Ubuntu. I have added another section on troubleshooting tips at the end of this article. Building and deploying ACE Applications, SOAP Services, RestAPIs, Policy projects, Static libraries and Shared libraries have been tested. Note that ace-maven-plugin has been updated and is available in github.
I had previously published a post; IIB (v9 and v10) Continuous Integration using Maven and Jenkins. This post is in continuation to that to explain the steps for performing a similar implementation for ACE v11.
The Maven plugin for IIB (iib-maven-plugin) has been enhanced and renamed to ace-maven-plugin for ACE. The plugin supports:-
- Building applications and services with referenced static library projects
- Building shared libraries independently
- Building newly introduced Policy projects independently
Note that the Shared libraries and Policy projects should be deployed before the referencing application/service can be deployed.
Note that the iib-maven-plugin was originally taken from GitHub and was enhanced for IIB v9 & v10.
This CI framework for ACE, built using Maven, Nexus, and Jenkins, can further be enhanced to deploy ACE in a microservices architecture pattern using Docker and Kubernetes. This is out of scope for this article.
In this article I will explain how to build an ACE v11 (App Connect Enterprise v11) project and deploy the bar file to target the Integration Server using Maven and Jenkins.
Here I will take a basic scenario and will explain all the steps. You should be able to use this information to build the CI infrastructure for ACE in your enterprise.
Scenario
Build ACE v11 projects
Create BAR file with all referenced libraries/projects/jars
Overwrite BAR file Node properties and User Defined Properties using Properties file
Deploy this BAR file on target Integration Server
Environment
ACE v11.0.0.4
Maven 3.2.1
Jenkins 2.73.3
ace-maven-plugin
Maven Eclipse Plugin (m2e) v1.5.1
Visual SVN server 3.9.3
Operating System
Windows 10
Make sure that the ACE v11 runtime and Toolkit are installed on your Build server. I assume this is already in place.
I have used the Maven version 3.2.1 here. You may install the latest Maven version. If you are new to Maven, don’t worry. It’s a very simple installation. Below are the steps to do it:
- Download Maven Binary Zip archive from https://maven.apache.org/download.cgi
- Extract the distribution archive in any directory.
- Ensure that you have JDK8 installed and that the JAVA_HOME environment variable is set & points to your JDK installation.
- Add the bin directory of the created Maven directory to the PATH environment variable.
- Confirm with mvn -v in a new shell. The result should look similar to:
6. Optionally you can change the local repository location in Maven settings.xml. You can find settings.xml in the ‘conf’ directory inside your Maven installation directory.
Sample settings file is available with ace-maven-plugin source code in github. You would need to update the repository & paths with respect to your environment:
Settings.xml
You can download the plugin source code from the below github location:
ace-maven-plugin-source-github
It contains settings.xml file that you can put inside ‘conf’ directory under maven home directory. Make sure to update it to have correct values for your environment.
After you download this plugin, unzip the file in any directory. Go to the POM.xml of the plugin and make sure to update the repository paths relevant to your environment. Also you can update the path below; however make sure that the path specified in this ‘workingDirectory’ exists in order to compile the plugin:
Make sure that you grant rw permission on this directory (/opt/releases).
You can install this plugin in the central repository of your enterprise. Here we will install it locally.
Open the command prompt and go to the directory where you extracted it. Navigate to the directory where the POM file is present and run the command “mvn clean install”. You may update the version of the plugin in POM.xml before running this command so that the appropriate version number for the plugin is reflected.
4. Complete the installation and restart the ACE toolkit.
5. Now change the settings in your toolkit to refer to Custom Maven installation instead of Embedded installation. Go to Window–>Preferences–>Maven–>Installations. Add the maven installation directory. If you want to keep using embedded installation, only update the the paths of the settings file.
6. Now checkout the ACE project into your ACE toolkit. Right click on the project –> Configure –> Convert to Maven project.
7. Provide the groupId, artifcatId and Version and select packaging as ‘pom’.
- Click on Finish.
Now we need to make configurations in the POM file. This POM is referencing to some variables from the Maven settings file. Below is a complete sample POM for the project I created:
Now look at the Configuration block.
toolkitInstallDir: Path of the ACE toolkit installation directory.
barName: Absolute path for bar file.
workspace: Absolute path for workspace.
versionString: Will be appended to Application name in bar file.
cleanBuild: default value is ‘true’.
deployAsSource: default value is ‘true’.
esql21: default value is false. If you are compiling mqsi2.1 esql file then it should be set to true.
applicationName: Name of applications to be included in bar file separated by space.
configPropFileDirectory: Absolute path for properties file to override bar file (UDPs and Node properties). If you are creating a PolicyProject or Shared library where property overriding is not applicable, you should either remove it or keep the empty tag for it.
defaultPropertiesFile: Absolute path for properties file where the plugin dumps all the properties for internal use.
debugWorkspace: Make this ‘true’.
applyBarOverride: ‘true’. If property overriding is not applicable, make it ‘false’.
Make sure that you have updated the repository paths as applicable to your environment. Keep the other settings the same as those in the sample POM.
Now your ACE Maven project is ready to compile. Make sure that the referenced projects are present in ‘workspace’. You can copy referenced library projects into workspace using a Jenkins pre-build step.
Now let us setup Jenkins and trigger the ACE Build from Jenkins.
You can just download the Jenkins WAR and use it with Tomcat or any other server. Here I will use a Windows installer and setup Jenkins as a Windows service.
Download the Windows installer from the url below:
http://jenkins-ci.org/content/thank-you-downloading-windows-installer
The installation is straightforward. Once installation is complete, you can access Jenkins using the url below:
http://localhost:8080
You can do access configuration in Jenkins using LDAP or AD server or local access setup. This part is not in scope of this article. We can continue without doing this access setup.
Go to ‘Manage Jenkins’ –> Configure System
Set ‘Workspace root directory’ and ‘Build record root directory’ as below:
If you are using newer version of Jenkins, both these variables have been moved to the Jenkins configuration file. Make sure to update them.
1. Go to ‘Manage Jenkins’ –> Global tool configuration
2. Set the Maven Configuration.
3. Give the path to settings.xml
4. Also add JDK installation for Jenkins.
5. Save it and exit.
1. Click on ‘New Item’ and give a name to the Jenkins job, the same as the corresponding Application/Service/Library/PolicyProject. 2. Select the check-box ‘maven-project’ and click ‘Ok’.
Now the Configuration page is open. We need to provide the configuration here. Give the SVN path of the application/library project
3. If there are referenced libraries, make sure to add a pre-build step to copy artifacts from library projects (static and shared). You would create a library project as a ‘freestyle’ project and archive all its artifacts so that they can be copied to the workspace when building the application/service.
4. Update the Build section as below:
5. Set the deployment command or batch file having deployment command.
6. Save the configuration.
You can do other additional configurations as per your requirement.
Now you are all set to trigger your build.
I triggered the Jenkins job and it built the bar file, overridden a node property using the properties file and deployed this new bar file to the target integration server. Attached is the sample properties file:
Sample Properties File
(DEV.properties)
Note that this property file has been put inside ACE application/service at the path configured in the POM file ()
Console Output
Started by user Anand Awasthi
Building in workspace E:\DevOps\Jenkins\jobs\Test.Application\workspace
Checking out a fresh workspace because E:\DevOps\Jenkins\jobs\Test.Application\workspace\Test.Application doesn’t exist
Cleaning local Directory Test.Application
Checking out https://desktop-s0joekp/svn/SourceCode/Test.Application/trunk/Test.Application at revision ‘2019-04-10T02:34:33.566 +0530’ –quiet
Using sole credentials aawasti/****** in realm ‘
MQSI 11.0.0.4
E:\IBM\ACE\11.0.0.4\server
BIP1040I: Deploying BAR file ‘E:\DevOps\Jenkins\jobs\Test.Application\workspace\Test.Application\target\ace\DEV_1.0.07-SNAPSHOT.bar’ to integration server ‘anand’ …
BIP9332I: Application ‘Test.Application’ has been changed successfully.
BIP1092I: The deployment request was processed successfully.
[WS-CLEANUP] Deleting project workspace…
[WS-CLEANUP] Deferred wipeout is used…
[WS-CLEANUP] done
Finished: SUCCESS
Rest APIs and SOAP services project give error after converting to maven project in ACE toolkit
I have seen users reporting this error and was able to reproduce in ACE 11.0.0.4 toolkit. This is probably some compatibility issue. The content of descriptor file of Rest API / SOAP service gets wiped-out after the project is converted to maven project. I have tested this scenario in ACE 11.0.0.7, where it works fine. If you are facing this issue, update your ACE to latest fix-pack.
Compiling the ACE project fails with errors like ‘.project’ file is not available
This error is related to the check-out location of your project. One way to handle it is below:
1) Update below parameter of jenkins config.xml:
#AppConnectEnterprise(ACE)#ACEV11#continuousintegration#Integration#Maven#Jenkins