The main questions for any given library are:
1. Should the library be included in the application archive?
2. Is the library needed during development to build the application?
There are three choices:
A. Add the library as a "
compile" scope dependency in the POM. The library will be included in the fragment and application archive. Upgrading the library requires rebuilding the application. This is the default choice for most dependencies. The library must be present in the developer's local Maven repository. Compile-scope ensures the version of the library used to build the application is the version that will be used at runtime.
B. Add the library as a "
provided" scope dependency in the POM. The library is available during 'build' but not included in the fragment archive. For the server to find the library at runtime the node deployment configuration needs to parameterize property
sbengine externalClassPath or the node needs a replacement sbengine configuration. Upgrading the library does not require rebuilding the fragment or application. The library must be present in the developer's local Maven repository.
C. Do not add the library as a dependency in the POM. The library is unavailable during development and will not be used for "build". For the server to find the library at runtime the node deployment configuration needs to parameterize property
sbengine externalClassPath or the node needs a replacement sbengine configuration. Upgrading the library does not require rebuilding the fragment/application. The library does not need to be present in the developer's local repository.
Copying a library into the local Maven repository
If the library has no internal
maven meta-data, then you'll need to research the following values and use command:
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>(See reference:
https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html)
Often a jar will have internal meta-data which tells maven where in the repository it should go, for example:
lv-client.jar/
META-INF/maven/com.tibco.ep.ldm/client/
pom.xml
pom.properties
...and from pom.properties:
#Created by Apache Maven 3.5.0
version=10.2.1
groupId=com.tibco.ep.ldm
artifactId=client
If the jar already has internal meta-data, use the command:
mvn install:install-file -Dfile=<path-to-file>Once a library is copied into the local repository then it may be added to the project POM as a
compile or
provided dependency.
Creating a parameterized engine configuration
For runtime deployment, including launching from SB Studio for testing, identify the library location using a
sbengine configuration with an
externalClassPath setting.
Example fragment engine.conf
name = "engine"
version = "1.0.0"
type = "com.tibco.ep.streambase.configuration.sbengine"
// EventFlow engine configuration. A subclass of the JavaEngine engine configuration.
configuration = {
StreamBaseEngine = {
externalClassPath = [
"${JDBCDRIVERJAR:-C:/Program Files/PostgreSQL/9.1/postgresql-9.1-903.jdbc4.jar}"
]
}
}
In this example, parameter "JDBCDRIVERJAR" may be replaced when using the 'epadmin install node' command, as so:
epadmin install node nodename=A.B application=hello_app.zip substitutions="JDBCDRIVERJAR=D:/Drivers/postgresql-9.1-903.jdbc4.jar"