Skip to content

Custom XPath Function with Maven

Vishal Pawar edited this page Feb 10, 2022 · 17 revisions

Custom XPath Function with Maven

Please follow below steps to use Custom XPath Function(CXF) with BW -

Step 1 : Create Custom XPath Function Project and BW Application

Step 2 : Mavenize the project and Generate POM files.

  • Ensure that the Custom XPath function(CXF) Project is added in Application Includes as below

  • Launch Generate POM file wizard. You should see XPath function Project in the list

The parent project pom.xml should list down all the modules as below -

 <modules>
    <module>../CXFDemo</module>
    <module>../CXFTest.module</module>
    <module>../CXFTest</module>
  </modules>
  • Add cxf common extension dependency in Custom XPath Function project pom.xml

Note - This step is not required for BW 6.8.0/ BWCE 2.7.0 onwards.

Note - The dependency artifact version is depend on BW version you are using.

To install execute command - mvn install:install-file -Dfile=<path-to-cxf-common-jar> -DgroupId=com.tibco.plugins -DartifactId=com.tibco.xml.cxf.common -Dversion=<version> -Dpackaging=jar

Example - mvn install:install-file -Dfile=C:\tibco\bw\6.6\system\shared\com.tibco.xml.cxf.common_1.3.600.001.jar -DgroupId=com.tibco.plugins -DartifactId=com.tibco.xml.cxf.common -Dversion=1.3.600 -Dpackaging=jar

  • Add below pom dependency in custom xpath function project pom.xml
<dependencies>
  	<dependency>
  		<groupId>com.tibco.plugins</groupId>
  		<artifactId>com.tibco.xml.cxf.common</artifactId>
  		<version>1.3.600</version>
  		<scope>provided</scope>
  	</dependency>
</dependencies>
  • Create bwutdev.properties file.

In your user home directory, create bwutdev.properties file (example - on windows, C:\Users\<user>\bwutdev.properties

Add your XPath function project entry in the file.

CXFDemo=bin,target/classes

Note - From 2.8.0 onwards, this step is optional. Plugin will generate dev.properties file. However, if needed, you can override same by providing bwutdev.properties file as mentioned above.

Step 3 : Running Unit Tests & Package

Note - Your BW application should have unit tests defined. Please refer Unit Testing section on the Wiki.

Note - tibco.home and bw.home properties should be provided in application pom.xml.

  • Create new Maven Run configuration. Select BW application parent project as base directory.

  • Provide maven goal clean test.

  • To generate an EAR, Provide maven goal clean package.

External Custom XPath Function with Maven

Please follow the below steps to use External Custom XPath Function(CXF) with BW -

Step 1

Create new Custom XPath Project - "cxfpro". Right Click, Select option "Generate POM for CXF Project". It will mavenize the project and generates pom.xml for the CXF Project.

Step 2

Create new "Run\Debug Configuration" for Maven. Select CXF Project and execute "clean install" goal. This will install the CXF Project in local .m2 repository.

Step 3

Open new eclipse workspace. Create new application project. Generate POM for your Application by right clicking on the Application and choosing the 'Generate POM for Application' menu item.

Step 4

Open the Application Module pom.xml and add the CXF Project dependency which is present in local maven repository. In this example I have a CXFPRO jar file which is in ~/.m2/repository folder

Save your pom.xml

You should now see the CXF Project in the Studio Project Explorer. Note the different icon for the project which indicates that the CXF Project is referenced and not in the workspace. Right click on CXF Project and choose "Install CXF Project" to start using Custom Functions in the BW project.

Step 5

Running Unit Tests & Package

Note - Your BW application should have unit tests defined. Please refer Unit Testing section on the Wiki.

Note - tibco.home and bw.home properties should be provided in application pom.xml.

Create new Maven Run configuration. Select BW application parent project as base directory.

Provide maven goal clean test.

To generate an EAR, Provide maven goal clean package.

Clone this wiki locally