This documentation supports the 20.02 version of BMC Helix Platform.

To view the documentation for the current version, select 20.08 from the Product version menu.

Using code from open source

Before you begin make sure that you create a project and a deployment package for Digital Service application (or smart library) development.

You can use the Java code from a third party code (such as code that is available as open source in Github) in your smart bundle. To use the third party code in your smart bundle, you need to specify the dependency in the pom.xml file located in the bundle project.

Notes

  • You cannot configure smart bundles with circular dependencies on each other. A circular dependency is a relation between two or more bundles which either directly or indirectly depend on each other to function properly.
  • You must deploy a bundle’s dependencies before you deploy a bundle to BMC Helix Platform.

To add the third party dependencies to your smart bundle

  1. Add the dependency of the third party code in the pom.xml file located in the bundle project. For more information, see  Dependencies Open link .
    For example, in the work-order-lib\bundle\pom.xml file, add a dependency of a library from Apache Commons to perform CSV parsing.

    <dependencies>
        
            <!-- Add a custom dependency to bring in 3rd party code.  -->
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-csv</artifactId>
                <version>1.1</version>
                <!-- Use the default scope of “compile” since this code is not in the AR Server -->
                  <scope>compile</scope>
            </dependency>


  2. Set up the dependencies in the maven bundle plugin .
    For example:

    . . .                
        <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <version>${maven-bundle-plugin.version}</version>
            <extensions>true</extensions>
            <configuration>
                <instructions>
                    <Bundle-Name>${rx-sdk.bundleName}</Bundle-Name>
                    <Bundle-SymbolicName>${rx-sdk.bundleId}</Bundle-SymbolicName>
                    <Bundle-Activator>com.example.bundle.MyApplication</Bundle-Activator>
                    <Import-Package>*;resolution:=optional</Import-Package>
                    <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
                    <Bundle-Description>${rx-sdk.bundleDescription}</Bundle-Description>
                    <Bundle-Vendor>${rx-sdk.bundleDeveloperId}</Bundle-Vendor>
                    <RxBundle-FriendlyName>${rx-sdk.bundleFriendlyName}</RxBundle-FriendlyName>
                    <RxBundle-IsApplication>${rx-sdk.bundleIsApplication}</RxBundle-IsApplication>
                            
                    <!-- Include any 3rd party dependencies -->
                    <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency> 
                            
                </instructions>
            </configuration>
        </plugin>


  3. Run the following command to navigate to the bundle directory and build the bundle :

    mvn clean install 

    For example:

    projects> cd work-order-lib\bundle
    bundle> mvn clean install 


  4. Verify the bundle.   
    For example, open the bundle work-order-lib\bundle\target\com.example.work-order-lib.1.0-SNAPSHOT.jar  and check the dependent library is distributed at the root location of the bundle.  
  5. Load the pom.xml file in Eclipse. Ensure that the project (for work-order-lib) is updated with the new pom.xml file settings.
    This enables the use of CSV library.
  6. Modify the required class in the Java code to use the library.
  7. Build and deploy the new code using the following command:

    mvn clean install -Pexport -Pdeploy

Where to go from here

Applying a license to your application

Was this page helpful? Yes No Submitting... Thank you

Comments