Repository Indexing
By default in StreamBase Studio, repository indexing is turned off, so libraries in local and remote repositories will not be found. To turn on indexing use menu:
Window > Preferences, Maven, enable "
Download repository index updates on startup", save the change and then restart SB Studio. The initial index update will take a few minutes. Subsequent updates will typically take a few seconds.
This can also be done from the
Maven Repositories view in Studio, by right-clicking the desired repository and choosing
Rebuild Index.
Using Maven Central
Most libraries are available from Maven Central, referenced in the StreamBase parent .pom as:
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
</repository>
Your may wish to use other public Maven repositories as well. References to additional repositories may be placed in your project
pom.xml file.
Using a Corporate Repository
In most development environments there will be a corporate "remote" Maven repository as described here:
https://maven.apache.org/guides/introduction/introduction-to-repositories.htmland to use it add to the project
pom.xml file an entry like this:
<repositories>
<repository>
<id>my-internal-site</id>
<url>http://myserver/repo</url>
</repository>
</repositories>
If you need to add libraries to your corporate repository you must have permission and the steps will be specific to your corporate environment and policies.
After making changes to your corporate repository, update your index in SB Studio, as described above.
Using a Local Repository
Before adding a library to your corporate repository you may want to work with it locally first. You may add library files to your private repository maintained on your system by Maven. These files will not be shared with other developers. Adding files to your private repository requires running the
mvn command from the command-line. The
mvn command is included with recent versions of TIBCO Streaming and is on the PATH when using the StreamBase Command Prompt environment.
As an example, the JMS Sample requires two library files from a TIBCO EMS install in order for the StreamBase JMS Operators to connect to an EMS server. Although the latest versions of these are available from Maven Central, you may wish to use specific older versions which may be installed locally as follows.
From the command-line, when you are in the tibco\ems\8.2\lib directory, the Maven commands to add the two files to your local repository are:
mvn install:install-file -Dfile=jms-2.0.jar -DgroupId=com.tibco.ems -DartifactId=jms -Dversion=2.0 -Dpackaging=jar -DgeneratePom=true
mvn install:install-file -Dfile=tibjms.jar -DgroupId=com.tibco.ems -DartifactId=tibjms -Dversion=8.2 -Dpackaging=jar -DgeneratePom=trueThe
mvn command needs to be on your system
PATH and the environment variable
JAVA_HOME needs to be set to the install location of a reasonably recent JRE. The session below includes the errors which occur when these are not set.
Here is a typical session accomplishing adding these libraries to a private repository:
C:\tibco\ems\8.2\lib>dir *.jar
Volume in drive C is Windows
Volume Serial Number is E8A5-1438
Directory of C:\tibco\ems\8.2\lib
09/28/2015 01:15 PM 40,067 jms-2.0.jar
09/28/2015 01:15 PM 15,279 slf4j-api-1.4.2.jar
09/28/2015 01:15 PM 7,470 slf4j-simple-1.4.2.jar
09/28/2015 01:15 PM 385,443 tibcrypt.jar
09/28/2015 01:10 PM 7,537 tibemsd_sec.jar
09/28/2015 01:15 PM 392,225 tibjms.jar
09/28/2015 01:15 PM 154,552 tibjmsadmin.jar
09/28/2015 01:15 PM 15,668 tibjmsapps.jar
09/28/2015 01:15 PM 67,955 tibjmsufo.jar
09/28/2015 01:15 PM 13,676 tibrvjms.jar
10 File(s) 1,099,872 bytes
0 Dir(s) 202,654,863,360 bytes free
C:\tibco\ems\8.2\lib>mvn install:install-file -Dfile=jms-2.0.jar -DgroupId=com.tibco.ems -DartifactId=jms -Dversion=2.0 -Dpackaging=jar -DgeneratePom=true
'mvn' is not recognized as an internal or external command,
operable program or batch file.
C:\tibco\ems\8.2\lib>set PATH=%PATH%;C:\Users\me\Downloads\apache-maven-3.3.9\bin
C:\tibco\ems\8.2\lib>mvn install:install-file -Dfile=jms-2.0.jar -DgroupId=com.tibco.ems -DartifactId=jms -Dversion=2.0 -Dpackaging=jar -DgeneratePom=true
Error: JAVA_HOME not found in your environment.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
C:\tibco\ems\8.2\lib>set JAVA_HOME=C:\tibco\sb-cep\10.1\jdk
C:\tibco\ems\8.2\lib>mvn install:install-file -Dfile=jms-2.0.jar -DgroupId=com.tibco.ems -DartifactId=jms -Dversion=2.0 -Dpackaging=jar -DgeneratePom=true
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---
[INFO] Installing C:\tibco\ems\8.2\lib\jms-2.0.jar to C:\Users\me\.m2\repository\com\tibco\ems\jms\2.0\jms2-2.0.jar
[INFO] Installing C:\Users\me\AppData\Local\Temp\mvninstall8387646642699441771.pom to C:\Users\me\.m2\repository\com\tibco\ems\jms\2.0\jms2-2.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.579 s
[INFO] Finished at: 2017-04-27T15:12:20-04:00
[INFO] Final Memory: 15M/483M
[INFO] ------------------------------------------------------------------------
C:\tibco\ems\8.2\lib>mvn install:install-file -Dfile=tibjms.jar -DgroupId=com.tibco.ems -DartifactId=tibjms -Dversion=8.2 -Dpackaging=jar -DgeneratePom=true
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---
[INFO] Installing C:\tibco\ems\8.2\lib\tibjms.jar to C:\Users\me\.m2\repository\com\tibco\ems\tibjms\8.2\ems-8.2.jar
[INFO] Installing C:\Users\me\AppData\Local\Temp\mvninstall2784652958246158057.pom to C:\Users\me\.m2\repository\com\tibco\ems\tibjms\8.2\ems-8.2.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.421 s
[INFO] Finished at: 2017-04-27T15:13:03-04:00
[INFO] Final Memory: 15M/483M
[INFO] ------------------------------------------------------------------------
After these libraries are added, you should then update your repository index in Studio and then add these as dependencies to your project.