How to access non-maven external java libraries in GeoEventServer the transport/adaptor applications

875
3
08-29-2019 05:59 AM
KanchibhotlaDheeraj
New Contributor

Hi, I'm trying to build custom transport and adapter while building them I'm facing issue while adding and accessing external non-maven jars to the project. please help me to 

0 Kudos
3 Replies
Stefan_Jung
Esri Contributor

Hi Kanchibhotla Dheeraj‌,

i think the best way to use this libraries is to add them to your local maven repository:

mvn install:install-file -Dfile=<path_to_project>\libraries\myJsonParser.jar

-DgroupId=com.myjsonparser -DartifactId=myjsonparser -Dversion=0.1 -Dpackaging=JAR

It is also important to make sure, that this libraries will be added to your target-JAR that will be added to the GeoEvent Server. I use the Maven Bundle Plugin for that:

Apache Felix - Apache Felix Maven Bundle Plugin (BND) 

So the Plugin Part of your POM could look like this:

<plugins>
   <plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <version>3.0.0</version>
    <extensions>true</extensions>
    <configuration>
     <instructions>
      <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
      <Bundle-ContactAddress>${sdk.contact.address}</Bundle-ContactAddress>
      <Bundle-Version>${project.version}</Bundle-Version>
      <Export-Package/>
      <Private-Package>org.foo.myproject.*</Private-Package>
      <Import-Package>*;resolution:=optional</Import-Package>          
      <Embed-Dependency>*;scope=compile|runtime;inline=true</Embed-Dependency>
      <Embed-Transitive>true</Embed-Transitive>  
     </instructions>
    </configuration>
   </plugin>    
 </plugins>

Best, 

Stefan

KanchibhotlaDheeraj
New Contributor

Hi Stefan,

I've added my external jars to the local maven repository. When I build the JAR using Felix plugin, JAR size becoming huge(7.5MB) which comprises all the classes. But Geo Event server is not accepting JAR more than 1MB.

0 Kudos
Stefan_Jung
Esri Contributor

Hi Kanchibhotla Dheeraj‌,

where did you get this 1 MB limit from? I have a lot of connectors and processors that are up to 5.4 MB. They are all working fine. What error message do you get?

Best Stefan

0 Kudos