Packaging for deployment
Packaging for deployment
To deploy your processing pipeline to the platform, first, you need to package it into a fat JAR. For specific instructions on building fat JARs, see the documentation of your build tool.
This section provides general instructions for building fat JARs with both SBT and Maven. If you are using the HERE platform Maven Archetypes to build your pipelines, you can skip this section and see the Guide for HERE Workspace for Java and Scala Developers instead.
NOTE: The Data Processing Library requires that each module/JAR have a
reference.conf file, all of which are loaded individually. If you merge multiple
JAR files into one JAR file, you also need to merge all your reference.conf files
into one. If you do not, the default settings cannot be loaded and your project
stops working.
If you use Maven to package your application, you can use
Apache Maven Shade Plugin
for
Resource Transformers
to merge all the reference.conf files on the classpath into one file.
Maven plugin configuration:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>allinone</shadedClassifierName>
<artifactSet>
<includes>
<include>*:*</include>
</includes>
</artifactSet>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>reference.conf</resource>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>project.Main</Main-Class>
</manifestEntries>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>Similarly, SBT also provides the following plugin configurations:
// sbt plugin
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "<latest-version>")
// sbt project
project.in(file("examples-project"))
.settings(
mainClass in assembly := Some("project.Main"),
defaultMergeSettings
)
lazy val defaultMergeSettings = {
assemblyMergeStrategy in assembly := {
case PathList("com", "esotericsoftware", xs@_*) => MergeStrategy.first
case PathList("org", "objenesis", xs@_*) => MergeStrategy.first
case x if Assembly.isConfigFile(x) => MergeStrategy.concat
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
}Updated 21 days ago