Using code from open source
To add the third-party dependencies to your smart bundle
Add the dependency of the third-party code in the pom.xml file located in the bundle project. For more information, see Dependencies.
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>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>Run the following command to navigate to the bundle directory and build the bundle :
mvn clean installFor example:
projects> cd work-order-lib\bundle
bundle> mvn clean install- 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. - 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.
- Modify the required class in the Java code to use the library.
Build and deploy the new code using the following command:
mvn clean install -Pexport -Pdeploy
Where to go from here
Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*