Thursday, October 8, 2015

IIB (v9 & v10)-ContinuousIntegration-Maven-Jenkins

[UPDATE]:- This article has been updated on 08/24/2018 to support build of IIB 10 projects. Wherever is mentioned v9 only, read it as v9 & v10. .
V10 plugin allows you to make Shared libraries as maven projects & build them independently. Note that the plugin code has been updated to make sure that shared libraries are not included in the bar files of referring projects to avoid unplanned changes in shared library going into runtime.

You can leave your comment or reach out to me at anand.awasthi@gmail.com if need help



In this article I will explain how to build an IIB (IBM Integration Bus v9 & v10) project and deploy the bar file to target Integration Server using Maven and Jenkins. I have not found very useful information around this, so thought to put it together. Here I will take a basic scenario and will explain all steps. You should be able to use this information to build the CI infrastructure for IIB in your enterprise.

Scenario:
             -- Build IIB (v9 & v10) 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:
                   IIB v9,v10
                   Maven 3.3.3
                   Jenkins 1.632
                   IIB-Maven-Plugin (from github)
                   Maven Eclipse Plugin (m2e) v1.4.1
                   TFS (Team Foundation Server) 2012
Operation System:
                  Windows 7

Step 1: Make sure that IIB v9 runtime and Toolkit are installed on your Build server. I assume this is already in place.

Step 2: Install Maven 3.3.3 or latest version. I have used version 3.3.3 here. If you are new to Maven, don't worry. It's a very simple installation. Below are steps to do it:
   -- Download Maven 3.3.3 Binary Zip archive from https://maven.apache.org/download.cgi
   -- Extract distribution archive in any directory
   -- Ensure JAVA_HOME environment variable is set and points to your JDK installation
   -- Add the bin directory of the created directory apache-maven-3.3.3 to the PATH environment variable
   -- Confirm with mvn -v in a new shell. The result should look similar to

-- Optionally you can change the local repository location in maven settings.xml . You can find settings.xml in 'conf' directory inside your maven installation directory.



Step 3:
          Install IIB-Maven-Plugin:        
Below is the v9 plugin source code:
v9 plugin

Below is v10 plugin source code:

v10 plugin

After you download this plugin, unzip the file in any directory. You can install this plugin in central repository of your enterprise. Here we will install it locally.
Open command prompt and go to the directory where you extracted it. Navigate to the directory where POM file is present and run the command "mvn clean install"
This will install the iib-maven-plugin in your local repository. If installed successfully, you will see 'BUILD SUCCESS' message as below:


Step 4:
    Convert IIB Project to Maven Project: IIB projects are nothing but Eclipse projects. You can convert them to maven project using command line or you can use m2e plugin to use IIB toolkit for project conversion.We will use here m2e plugin. Follow below steps to install m2e plugin on your IIB toolkit:
          -- Go to Help --> Install New Software
          -- If not already there, add the site http://download.eclipse.org/technology/m2e/releases
          -- Make sure you uncheck the check-box 'Show only the latest versions of software available'. Install m2e-Maven Integration for Eclipse 1.4.1 and m2e-slf4j over logback logging v 1.4.1



Complete the installation and restart IIB toolkit.

Now change 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.



Now checkout the IIB project into your IIB toolkit. Right click on the project --> Configure --> Convert to Maven project.

Provide the groupId, artifcatId and Version and select packaging as 'pom'.

Click on Finish.

Now we need to make configurations in POM file. Here I have put central repository info in POM; ideally we should put it in settings.xml. Below is a complete sample POM for the project I created:
Sample POM

Note that I have changed packaging to 'iib-bar'.
<groupId>com.endur.esb.dummy</groupId>
<artifactId>GeniusStatus_Dummy_App</artifactId>
<version>1.0</version>
<packaging>iib-bar</packaging>

You can update the central repository info or remove it. By default it will go to internet.

Now look at the Configuration block.
toolkitInstallDir: Path of the IIB 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)
defaultPropertiesFile: Absolute path for properties file where the plugin dumps all the properties for internal use
debugWorkspace: Make this 'true'

Keep other settings same as that of in the sample POM.
Now your IIB Maven project is ready to compile. Make sure that the referenced projects are present in 'workspace'.

Step 5:
    Setup Jenkins:
Now let us setup Jenkins and trigger IIB Build from Jenkins.
You can just download the Jenkins WAR and use it with Tomcat or any other server. Here I will use Windows installer and setup Jenkins as Windows service.
Download the Windows installer from below url:

http://jenkins-ci.org/content/thank-you-downloading-windows-installer

It's installation is straightforward. Once installation is complete, you can access jenkins using below url:
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 the Maven Configuration.

Give the path to settings.xml

Save it and exit.

Step 6:
   Setup Jenkins job to build and deploy IIB bar:
Click on 'New Item' and give name to item. Select the check-box 'maven-project' and click 'Ok'

Now the Configuration page is open. We need to provide the configuration here. Please note that here I am setting to check-out only main project from TFS assuming that previous jobs will do a 'checkout only' of referenced projects in workspace. Provide the project paths and credential to checkout from TFS:

Select the appropriate Build Trigger.
Provide the absolute path for ROOT POM of the project.
Set the Goals and Options
Set the deployment command or batch file having deployment command.

Save the configuration.
You can do all 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 properties file and deployed this new bar file to target integration server. Attached is the sample properties files:
sample properties file

Below is the output of the build:


Getting version 'C89878' to 'C:\Anand\jenkins\workspace\GeniusStatus_Dummy_App'...
Finished getting version 'C89878'.
Parsing POMs
Established TCP socket on 52558
[GeniusStatus_Dummy_App] $ "C:\Program Files\Java\jdk1.7.0_79/bin/java" -Xms1024m -Xmx4096m -XX:PermSize=1024m -cp "C:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven32-agent-1.7.jar;C:\Anand\DevOps\apache-maven-3.3.3\boot\plexus-classworlds-2.5.2.jar;C:\Anand\DevOps\apache-maven-3.3.3/conf/logging" jenkins.maven3.agent.Maven32Main C:\Anand\DevOps\apache-maven-3.3.3 "C:\Program Files (x86)\Jenkins\war\WEB-INF\lib\remoting-2.52.jar" "C:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven32-interceptor-1.7.jar" "C:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.7.jar" 52558
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven:  -B -f C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App\pom.xml -s C:\Anand\DevOps\apache-maven-3.3.3\conf\settings.xml -gs C:\Anand\DevOps\apache-maven-3.3.3\conf\settings.xml clean package
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building GeniusStatusDummy 1.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ GeniusStatus_Dummy_App ---
[INFO] Deleting C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App\target
[INFO] 
[INFO] --- iib-maven-plugin:2.1-SNAPSHOT:prepare-bar-build-workspace (default-prepare-bar-build-workspace) @ GeniusStatus_Dummy_App ---
[INFO] 
[INFO] --- iib-maven-plugin:2.1-SNAPSHOT:validate-bar-build-workspace (default-validate-bar-build-workspace) @ GeniusStatus_Dummy_App ---
[INFO] 
[INFO] --- iib-maven-plugin:2.1-SNAPSHOT:create-bar (default-create-bar) @ GeniusStatus_Dummy_App ---
[INFO] Creating bar file: C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App\target\iib\GeniusDummy.bar
[INFO] executeMqsiCreateBar command:  "C:\Program Files (x86)\IBM\IntegrationToolkit90\mqsicreatebar" -data C:\Anand\jenkins\workspace -b C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App\target\iib\GeniusDummy.bar -cleanBuild -version 1.0 -a GeniusStatus_Dummy_App -deployAsSource -trace -v C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App\target\createbartrace.txt
[INFO] 
[INFO] C:\Anand\jenkins\workspace>"C:\Program Files (x86)\IBM\IntegrationToolkit90\mqsicreatebar" -data C:\Anand\jenkins\workspace -b C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App\target\iib\GeniusDummy.bar -cleanBuild -version 1.0 -a GeniusStatus_Dummy_App -deployAsSource -trace -v C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App\target\createbartrace.txt 
[INFO] Command log file is set to: C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App\target\createbartrace.txt
[INFO] BIP0986I Command completed successfully.
[INFO] 
[INFO] 
[INFO] 
[INFO] 
[INFO] Classloaders are not in use. The following jars will be removed from the bar file: **/javacompute_**.jar,**/jplugin2_**.jar
[INFO] 
[INFO] --- iib-maven-plugin:2.1-SNAPSHOT:validate-configurable-properties (default-validate-configurable-properties) @ GeniusStatus_Dummy_App ---
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App\src\main\resources
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App\src\test\resources
[INFO] Reading bar file: C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App\target\iib\GeniusDummy.bar
[INFO] mqsireadbar complete
[INFO] Writing configurable properties to: C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App\target\iib\default.properties
[INFO] Validating properties files
[INFO]   C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App\Genius.properties
[INFO] Applying properties files as bar file overrides
[INFO]   C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App\Genius.properties
[INFO] 
[INFO] C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App>"C:\Program Files (x86)\IBM\IntegrationToolkit90\mqsiapplybaroverride" -b C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App\target\iib\GeniusDummy.bar -o C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App\Genius.bar -p C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App\Genius.properties -k GeniusStatus_Dummy_App_1.0 -r -v C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App\target\applybaroverridetrace-Genius.txt 
[INFO] BIP1137I: Applying overrides using toolkit mqsiapplybaroverride...
[INFO] BIP1140I: Overriding property GeniusStatus_DummyService_Flow#HTTP Input.URLSpecifier with '/Anand/DataArea/StatusService' in 'GeniusStatus_Dummy_App_1.0.appzip/META-INF/broker.xml' ...
[INFO] BIP1143I: Saving Bar file C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App\Genius.bar...
[INFO] 
[INFO] BIP8071I: Successful command completion.
[INFO] 
[INFO] --- iib-maven-plugin:2.1-SNAPSHOT:clean-bar-build-workspace (default-clean-bar-build-workspace) @ GeniusStatus_Dummy_App ---
[INFO] debugWorkspace enabled - workspace will not be cleaned
[INFO] 
[INFO] --- iib-maven-plugin:2.1-SNAPSHOT:validate-classloader-approach (default-validate-classloader-approach) @ GeniusStatus_Dummy_App ---
[INFO] Reading configurable properties from: C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App\target\iib\default.properties
[INFO] 
[INFO] --- iib-maven-plugin:2.1-SNAPSHOT:package-iib-bar (default-package-iib-bar) @ GeniusStatus_Dummy_App ---
[INFO] Building zip: C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App\target\GeniusStatus_Dummy_App-1.0.zip
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:31 min
[INFO] Finished at: 2015-10-08T08:52:11-04:00
[INFO] Final Memory: 25M/982M
[INFO] ------------------------------------------------------------------------
[JENKINS] Archiving C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App\pom.xml to com.endur.esb.dummy/GeniusStatus_Dummy_App/1.0/GeniusStatus_Dummy_App-1.0.pom
[JENKINS] Archiving C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App\target\GeniusStatus_Dummy_App-1.0.zip to com.endur.esb.dummy/GeniusStatus_Dummy_App/1.0/GeniusStatus_Dummy_App-1.0.zip
channel stopped
[GeniusStatus_Dummy_App] $ cmd /c call C:\WINDOWS\TEMP\hudson9075319975353138395.bat

C:\Anand\jenkins\workspace\GeniusStatus_Dummy_App>C:\"Program Files"\IBM\MQSI\9.0.0.3\bin\mqsiprofile   && mqsideploy -i hostname -p port -q QMHM1DEV3 -e ClaimsServices -a C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App\Genius.bar -w 180 

MQSI 9.0.0.3
C:\Program Files\IBM\MQSI\9.0.0.3

BIP1044I: Connecting to the queue manager...
BIP1060I: Connecting to the broker...
BIP1115I: Connected to the broker 'IBHM1DEV3'.
BIP1039I: Deploying BAR file 'C:\Anand\SourceCode\EA.Integration\ClaimsFeedService\GeniusStatus_Dummy_App\Genius.bar' to broker 'IBHM1DEV3' (execution group 'ClaimsServices') ...
BIP1092I: The broker successfully processed the deployment request.
Finished: SUCCESS

91 comments:

  1. it's helpful,really great stuff.

    ReplyDelete
  2. For those who have problems with iib-maven-plugin, edit the .pom file and change url http://tstwp1apar2:8081/nexus/content/groups/public/ to http://maven.wso2.org/nexus/content/groups/wso2-public/, http://TSTWP1APAR2:8081/nexus/content/repositories/releases to http://maven.wso2.org/nexus/content/repositories/releases/ and http://TSTWP1APAR2:8081/nexus/content/repositories/snapshots to http://maven.wso2.org/nexus/content/repositories/snapshots/.

    ReplyDelete
  3. Does this plugin simply execute mqsicreate bar command?

    ReplyDelete
    Replies
    1. The latest Version of the iib-maven-plugin executes an mqsipackage bar. As such, it is not dependent on an Installation of IIB Toolkit and can easily be run by a normal Maven Installation (also under Jenkins)

      Delete
    2. mqsipackagebar is being used by this plugin. It needs compiled resources. It's not a replacement for mqsicreatebar.

      Delete
  4. It does createbar and overridebar also to overwrite node properties or user defined properties

    ReplyDelete
  5. When using jdk1.8.0_65 build fails with following error.
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.10.3:jar (attach-javadocs) on project iib-maven-plugin: MavenReportException: Error while generating Javadoc:
    [ERROR] Exit code: 1 - /opt/iib-maven-plugin/src/main/java/ch/sbb/maven/plugins/iib/mojos/CreateBarMojo.java:279: warning: no description for @throws
    [ERROR] * @throws MojoFailureException
    [ERROR] ^
    [ERROR] /opt/iib-maven-plugin/src/main/java/ch/sbb/maven/plugins/iib/mojos/CreateBarMojo.java:74: error: bad HTML entity
    [ERROR] * Include artifacts pattern (or patterns, comma separated). By default, the default value used for mqsipackagebar, except .esql & .subflow, which as not compilable
    [ERROR] ^
    [ERROR] /opt/iib-maven-plugin/src/main/java/ch/sbb/maven/plugins/iib/mojos/ValidateConfigurablePropertiesMojo.java:545: warning: no description for @param
    [ERROR] * @param outputLine
    [ERROR] ^
    [ERROR] /opt/iib-maven-plugin/src/main/java/ch/sbb/maven/plugins/iib/mojos/ValidateConfigurablePropertiesMojo.java:546: warning: no description for @return
    [ERROR] * @return
    [ERROR] ^
    [ERROR] /opt/iib-maven-plugin/src/main/java/ch/sbb/maven/plugins/iib/utils/EclipseProjectUtils.java:37: warning: no description for @param
    [ERROR] * @param workspace
    [ERROR] ^
    ....
    To resolve this issue, changed javadoc plugin to 2.10.3 and added -Xdoclint:none to pom.xml configuration.
    Following is the snippet of pom.xml.

    <plugin>

    <groupId>org.apache.maven.plugins</groupId>

    <artifactId>maven-javadoc-plugin</artifactId>

    <version>2.10.3</version>

    <configuration>

    <additionalparam>-Xdoclint:none</additionalparam>

    <configuration>

    </plugin>

    ReplyDelete
  6. Hi thank you for your post could you please upload you iib maven plugin again ? The url you provide is no more available.Thank you.

    ReplyDelete
  7. Hi,

    Could you please attache working copy of the plugin. I took the plugin and for me it failed with error: Failure to find com.ibm.etools.mft.config:ConfigManagerProxy:jar:9.0.300.v20150305-1357 in https://repo.maven.apache.org/maven2

    ReplyDelete
    Replies
    1. you need to supply the required jars (config manager proxy jars). Copy them in your local maven deploy location.

      Delete
    2. Thanks Anand.
      I am creating a RESTAPI using V 10.0.0.4
      Everytime I try to configure it as Maven project it gives me NPE and The Application or Library project has multiple conflicting project natures.
      Could you please help with this

      Delete
    3. Hi Aartie, I have tested the plugin with iib v9. I will check when get chance.
      Thanks

      Delete
    4. You'll find a script to deploy the required (non-distributable) IBM jars in the src/test/resources Directory (https://github.com/SchweizerischeBundesbahnen/iib-maven-plugin/blob/develop/src/test/resources/deploy-jars.sh)

      Delete
    5. Thanks Anand.
      I have created a ne wproject to create bAR for iib v10 project for now.
      The bar got created just fine. While executing mqsireadbar, the size of output is 3, which includes one null, command for execution ad third with error messgae- The system cannot find the path specified.
      Also total configurable properties read is 0. therefore my default.properties is blank.
      Would you please guide me as to how to use the plugin for override and how this override would work. Appreciate it

      Delete
    6. Also package-iib-bar fails for me with following error:
      DEBUG] All known ContainerDescriptorHandler components: [metaInf-services, plexus, file-aggregator, metaInf-spring]
      [DEBUG] FileSet[] dir perms: -1 file perms: -1
      [DEBUG] The archive base directory is 'null'
      [DEBUG] No dependency sets specified.
      [DEBUG] Cannot find ArtifactResolver with hint: project-cache-aware
      org.codehaus.plexus.component.repository.exception.ComponentLookupException: java.util.NoSuchElementException
      role: org.apache.maven.artifact.resolver.ArtifactResolver
      roleHint: project-cache-aware

      Delete
    7. Hi Anand and Aartie, How did you solve the problem "The Application or Library project has multiple conflicting project natures." ?
      Everytime I try to import the project as a maven project it gives me this error.

      How do you import the projects in toolkit? As existing maven project or as existing project into workspace?
      tks

      Delete
    8. I am also facing issue "The Application or Library project has multiple conflicting project natures"

      Delete
  8. Hi Anand, thanks. Very useful stuff. One quick question. In the bar file deployment step, my bar file name changes with every build as the timestamp is added to it. How to refer this dynamically changing bar file name (from the POM variable) in the Post Build step ? I tried with project.target.barfile as configured in the pom.xml, but no luck. Thanks in advance.

    ReplyDelete
    Replies
    1. You can update the iib maven plugin source code to have desired convention for BAR file name. In the plugin I updated it to have envrionment name appended with POM version, e.g. DEV_1.5.bar, QA_1.5.bar etc...

      Delete
    2. You should be able to add "-Diib.barName=any.fileName.I.Choose.bar" to your Maven command line (or arguably you could configure it in your settings.xml or pom.xml).

      Delete
    3. Yes, correct. There are multiple ways to handle these. One thing I didn't like in the plugin that it appends the version number in Application name, so actually a redeployment becomes an independent deployment .e.g. APP_1.0, APP_2.0. So I modified this part also in source code to not to append versionString in Application name, rather add it in deployed BAR file name. So effectively we know which version of Application is deployed. Also, since we come across the scenarios where we need to override bar file with environment specific parameters. Do taking the assumption that we have a properties file for each environment, modified the code to create a BAR file corresponding to each properties file. For example, if you supply three properties files DEV.properties, QA.properties and PROD.properties and if you are building version 1.x; it will create three BAR files namely DEV_1.x.bar, QA_1.x.bar and PROD_1.x.bar
      For deployment, we can pull specific bar file and deploy.

      Delete
  9. mr Awasthi thank you for this blog.

    It works perfectly.

    ReplyDelete
  10. This comment has been removed by the author.

    ReplyDelete
  11. Hi, I am stuck at step 5,

    while building the workspace IIB toolkit throws an error :

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    "Errors occurred during the build. Errors running builder 'Maven Project Builder' on project 'XXXXX'.java.lang.NullPointerException"
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    If I ignore this and proceed with running Jekins job, I get

    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    [WARNING] The POM for ch.sbb.maven.plugins:iib-maven-plugin:jar:2.3-SNAPSHOT is missing, no dependency information available
    [ERROR] [ERROR] Some problems were encountered while processing the POMs:
    [ERROR] Unresolveable build extension: Plugin ch.sbb.maven.plugins:iib-maven-plugin:2.3-SNAPSHOT or one of its dependencies could not be resolved: Could not find artifact ch.sbb.maven.plugins:iib-maven-plugin:jar:2.3-SNAPSHOT @
    [ERROR] Unknown packaging: iib-bar @ line 6, column 13
    @
    [ERROR] The build could not read 1 project -> [Help 1]

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    Appreciate your advice on this.

    ReplyDelete
    Replies
    1. Hi Varun,
      Make sure iib-maven-plugin is installed and you are referring the installed version from your project POM.

      Thanks
      Anand

      Delete
    2. This comment has been removed by the author.

      Delete
    3. Yes, plugin is installed successfully at local repository:

      [INFO] Installing C:\iib-maven-plugin\target\iib-maven-plugin-2.3-SNAPSHOT.jar
      to C:\Users\Administrator\.m2\repository\ch\sbb\maven\plugins\iib-maven-plugin\
      2.3-SNAPSHOT\iib-maven-plugin-2.3-SNAPSHOT.jar
      [INFO] Installing C:\iib-maven-plugin\pom.xml to C:\Users\Administrator\.m2\rep
      ository\ch\sbb\maven\plugins\iib-maven-plugin\2.3-SNAPSHOT\iib-maven-plugin-2.3
      -SNAPSHOT.pom
      [INFO] Installing C:\iib-maven-plugin\target\iib-maven-plugin-2.3-SNAPSHOT-sour
      ces.jar to C:\Users\Administrator\.m2\repository\ch\sbb\maven\plugins\iib-maven
      -plugin\2.3-SNAPSHOT\iib-maven-plugin-2.3-SNAPSHOT-sources.jar
      [INFO] Installing C:\iib-maven-plugin\target\iib-maven-plugin-2.3-SNAPSHOT-java
      doc.jar to C:\Users\Administrator\.m2\repository\ch\sbb\maven\plugins\iib-maven
      -plugin\2.3-SNAPSHOT\iib-maven-plugin-2.3-SNAPSHOT-javadoc.jar
      [INFO] ------------------------------------------------------------------------

      [INFO] BUILD SUCCESS

      ++++++++++++++++++++++++++++++++++++++++++++

      POM.xml is pointing to same.

      Delete
  12. This comment has been removed by the author.

    ReplyDelete
  13. Thanks for the great blog post. It's great to see that this stuff is being used by others. Even better that Anand Awasthi documented it. THANK YOU!

    Questions about this blog post are best addressed here. Concrete problems with plugin can be logged under https://github.com/SchweizerischeBundesbahnen/iib-maven-plugin/issues

    That said, Swiss Federal Railways currently uses IIB9 with no current plans to upgrade to IIB10. Given the dependency on design decisions from IBM, it may or may not be possible to have one version of this plugin work with multiple versions of IIB. We'd be happy to work with anyone wanting to help sort out the IIB10 problems.

    Kind regards,
    Jamie Townsend

    ReplyDelete
    Replies
    1. Hi Jamie,
      I will work with IIB 10 automation, hopefully next month. Please do let me know issues you face.

      Thanks,
      Anand

      Delete
    2. Hi Anand,I have updated the plugin to match IIB v10.
      I have tested the same. The plugin builds and deploys deploys BAR to target integration server.

      Delete
    3. Thanks victorys. What changes did you require to make it work wit iib10?

      Delete
    4. This comment has been removed by the author.

      Delete
    5. Could you please provide with the changes you made to the plugin to support IIB 10 ?

      Delete
    6. Hi Anand and Victorys, could you please provide with the changes?

      Delete
    7. Link to v10 plugin has been updated in article above. You can take it now.

      Delete
  14. Hi Anand,
    I am trying to replicate the above steps in our QA environment. So , as part of Step 3, I have place the unextracted zip folder into SVN and updated the POM.xml file and trying to build iib-maven-plugin from Jenkins.

    But I receive following error :

    [INFO] --- maven-plugin-plugin:3.2:descriptor (default-descriptor) @ iib-maven-plugin ---
    [INFO] Using 'UTF-8' encoding to read mojo metadata.
    [INFO] Applying mojo extractor for language: java-annotations
    [INFO] Mojo extractor for language: java-annotations found 14 mojo descriptors.
    [INFO] Applying mojo extractor for language: java
    [INFO] Mojo extractor for language: java found 0 mojo descriptors.
    [INFO] Applying mojo extractor for language: bsh
    [INFO] Mojo extractor for language: bsh found 0 mojo descriptors.
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 16.539 s
    [INFO] Finished at: 2016-05-03T14:34:10+02:00
    [INFO] Final Memory: 30M/95M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.2:descriptor (default-descriptor) on project iib-maven-plugin: The API of the mojo scanner is not compatible with this plugin version. Please check the plugin dependencies configured in the POM and ensure the versions match. JVMCFRE006 invalid StackMap/StackMapTable attribute; class=sun/awt/AppContext, method=dispose()V, pc=471 -> [Help 1]
    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.2:descriptor (default-descriptor) on project iib-maven-plugin: The API of the mojo scanner is not compatible with this plugin version. Please check the plugin dependencies configured in the POM and ensure the versions match.

    ReplyDelete
  15. Hi Anand,
    I am trying to mavenze a workspace from the command line and am getting the following error output:

    c:\IIB_Workspaces\Maven>mvn -Doverwrite=true -DgroupId=uk.co.allianz.corptech -Dversion=9.0-SNAPSHOT
    -Dmaven.multiModuleProjectDirectory=C:\Users\S45324\.m2\ -Ddistribution.repository=file:C:\Users\S
    45324\.m2\repository\ -Dworkspace=C:\IIB_Workspaces\Maven ch.sbb.maven.plugins:iib-maven-plugin:9.0-
    SNAPSHOT:mavenize
    [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] Building Maven Stub Project (No POM) 1
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] --- iib-maven-plugin:9.0-SNAPSHOT:mavenize (default-cli) @ standalone-pom ---
    [INFO] .project found found in directory C:\IIB_Workspaces\Maven\Test_Project
    [INFO] 1 non-application projects found in workspace; 0 application projects found in workspace
    [INFO] analyzing project dependencies for Test_Project
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 1.931s
    [INFO] Finished at: Mon Jul 25 09:44:56 BST 2016
    [INFO] Final Memory: 2M/15M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal ch.sbb.maven.plugins:iib-maven-plugin:9.0-SNAPSHOT:mavenize (default-
    cli) on project standalone-pom: Execution default-cli of goal ch.sbb.maven.plugins:iib-maven-plugin:
    9.0-SNAPSHOT:mavenize failed: String index out of range: 36 -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following arti
    cles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
    c:\IIB_Workspaces\Maven>

    This is the first time that I have used the plugin so mybe I don't have everything 100% correct but could you please provide any assistance?

    Regards,
    Brendan

    ReplyDelete
  16. Hi Anand,
    What if the IIB Application refers any jar files?
    Do we need to copy those jars into Application directory Or can we just mention that as maven dependency?
    I need those jar files should be present in bar file when I build it

    Thanks
    Panneer

    ReplyDelete
  17. Hi Anand,

    I want to deploy shared Library through Maven .
    Could you please guide me.

    ReplyDelete
    Replies
    1. I have uploaded the plugin for v10. It handles the shared library build.

      Delete
  18. This comment has been removed by the author.

    ReplyDelete
  19. Hi Ananda,

    One question, is it mandatory to install IIB toolkit on build server? Is Maven not capable enough to pull the jar files required for build from centralized repository?
    Our environment comprises of not just IIB, we also have datapower, WSRR etc. So in order to automate those, do we have to install all those softwares on build server. I m sure there must be a way to automate the build without having to install all the softwares. Can you please let me know?

    ReplyDelete
  20. need to know how i can setup GUI where dropdown will give list of EGs available under 1 broker?

    ReplyDelete
    Replies
    1. you can do that; however will need to write small script for this

      Delete
  21. Still some issues in pom file so we fixed them
    I'm uploading that pom file in the link
    reefer it for installing plugin.
    https://drive.google.com/drive/folders/15rG9sPJbfEuwLbPxD8Gmpvfx4lx7c-4P?usp=sharing

    ReplyDelete
  22. i did all steps but still getting error-

    Building in workspace C:\jen\ws
    Parsing POMs
    Established TCP socket on 49229
    [BreakAd_BSS_Landmark] $ java -cp "C:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven35-agent-1.12.jar;C:\mydrive\SKY\SOFTWARE\apache-maven-3.6.0\apache-maven-3.6.0\boot\plexus-classworlds-2.5.2.jar;C:\mydrive\SKY\SOFTWARE\apache-maven-3.6.0\apache-maven-3.6.0/conf/logging" jenkins.maven3.agent.Maven35Main C:\mydrive\SKY\SOFTWARE\apache-maven-3.6.0\apache-maven-3.6.0 "C:\Program Files (x86)\Jenkins\war\WEB-INF\lib\remoting-3.27.jar" "C:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven35-interceptor-1.12.jar" "C:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.12.jar" 49229
    <===[JENKINS REMOTING CAPACITY]===>channel started
    Executing Maven: -B -f C:\jen\ws\BreakAd_BSS_Landmark\pom.xml clean package
    [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------< com.sky.iib:BreakAd_BSS_Landmark >------------------
    [INFO] Building BreakAd_BSS_Landmark 0.0.1-SNAPSHOT
    [INFO] ------------------------------[ iib-bar ]-------------------------------
    [INFO]
    [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ BreakAd_BSS_Landmark ---
    [INFO]
    [INFO] --- iib-maven-plugin:4.3-SNAPSHOT:prepare-bar-build-workspace (default-prepare-bar-build-workspace) @ BreakAd_BSS_Landmark ---
    [INFO]
    [INFO] --- iib-maven-plugin:4.3-SNAPSHOT:validate-bar-build-workspace (default-validate-bar-build-workspace) @ BreakAd_BSS_Landmark ---
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 2.844 s
    [INFO] Finished at: 2018-12-30T17:41:33Z
    [INFO] ------------------------------------------------------------------------
    Waiting for Jenkins to finish collecting data
    [ERROR] Failed to execute goal ch.sbb.maven.plugins:iib-maven-plugin:4.3-SNAPSHOT:validate-bar-build-workspace (default-validate-bar-build-workspace) on project BreakAd_BSS_Landmark: Error parsing .project file in: C:\jen\ws\.git: UnmarshalException: C:\jen\ws\.git\.project (The system cannot find the file specified) -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [JENKINS] Archiving C:\jen\ws\BreakAd_BSS_Landmark\pom.xml to com.sky.iib/BreakAd_BSS_Landmark/0.0.1-SNAPSHOT/BreakAd_BSS_Landmark-0.0.1-SNAPSHOT.pom
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
    channel stopped
    Finished: FAILURE


    ReplyDelete
  23. Hi
    Has anyone been able to use mqsipackagebar with this plugin?
    I'm getting the following error:

    Caused by: org.apache.maven.plugin.MojoFailureException: java.lang.NullPointerException

    I used version 10.
    1. how can I configure my pom file for mqsipackagebar parameters like -k -y ,etc ?
    my pom file is like this currently:


    localdev

    true


    F:\ibm\workspace\autodeploy
    **/*.jar
    false
    C:\Program Files\IBM\IIB\10.0.0.13\server\bin\mqsiprofile.cmd
    true
    false
    true
    package
    true
    600
    true
    true








    ch.sbb.maven.plugins
    iib-maven-plugin
    10.0-SNAPSHOT
    true

    ${workspace}
    ${initialDeletes}
    ${unpackIibDependenciesIntoWorkspace}
    ${pathToMqsiProfileScript}
    ${failOnInvalidProperties}
    ${useClassloaders}
    ${failOnInvalidClassloader}
    ${createOrPackageBar}

    ${completeDeployment}
    ${timeoutSecs}


    true
    ${iibDependenciesLocal}








    org.eclipse.m2e
    lifecycle-mapping
    1.0.0






    ch.sbb.maven.plugins


    iib-maven-plugin


    [10.0-SNAPSHOT,)



    initialize-bar-build-workspace















    2. should i change my "goal" ?

    thanks in advance.

    ReplyDelete
  24. Nice post, Good work. I would like to share this post on my blog.
    servicenow training

    ReplyDelete
  25. Hi,
    I am getting the below error.Can any one suggestions on it?

    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project iib-maven-plugin: Compilation failure: Compilation failure:
    [ERROR] /C:/iib-maven-plugin/src/main/java/ch/sbb/maven/plugins/iib/mojos/ValidateBarBuildWorkspaceMojo.java:[18,52] package ch.sbb.maven.plugins.iib.generated.maven_pom does not exist
    [ERROR] /C:/iib-maven-plugin/src/main/java/ch/sbb/maven/plugins/iib/utils/PomXmlUtils.java:[10,52] package ch.sbb.maven.plugins.iib.generated.maven_pom does not exist
    [ERROR] /C:/iib-maven-plugin/src/main/java/ch/sbb/maven/plugins/iib/utils/PomXmlUtils.java:[23,19] cannot find symbol

    ReplyDelete
  26. Nice post, Good work. I would like to share this post on my blog.
    servicenow certification

    ReplyDelete
  27. Not able to download files from Google drive from client system because drive is blocked.. Is there any other way I could get these files? any github location ?

    ReplyDelete
  28. This comment has been removed by the author.

    ReplyDelete

  29. Good Post! Thanks for sharing such a valuable information.
    DevOps Training
    DevOps Online Training

    ReplyDelete
  30. .Everyone wants to get unique place in the IT industry’s for that you need to upgrade your skills, your blog helps me improvise my skill set to get good career, keep sharing your thoughts with us.
    keep it up!!

    android training in chennai

    android online training in chennai

    android training in bangalore

    android training in hyderabad

    android Training in coimbatore

    android training

    android online training

    ReplyDelete
  31. Nice. I am really impressed with your writing talents and also with the layout on your weblog. Appreciate, Is this a paid subject matter or did you customize it yourself? Either way keep up the nice quality writing, it is rare to peer a nice weblog like this one nowadays. Thank you, check also event management and Engaging Your Remote Audience

    ReplyDelete
  32. I am stuck at point 4. I was able to convert the project into Maven but getting issues with the POM file.

    packaging = *iib-bar* is not a valid option . I have set the value as POM for now. Receiving below error when I copy section from your POM file and paste it in my file.

    Project build error: Unresolveable build extension: Plugin ch.sbb.maven.plugins:iib-maven-plugin:4.3-SNAPSHOT or one of its dependencies could not be resolved: The following artifacts could not be resolved: ch.sbb.maven.plugins:iib-maven-plugin:jar:4.3-SNAPSHOT, org.codehaus.plexus:plexus-utils:jar:1.1: Could not find artifact ch.sbb.maven.plugins:iib-maven-plugin:jar:4.3-SNAPSHOT

    I am new to this maven concept and to use it in a project. Can you please guide me.

    Maven version: 3.8.1
    IIB 10

    ReplyDelete