Building Shaded JARs

The easiest way to use Genesis is to package the Genesis Controller and the implementation of the tracker and all component transformators into shaded JARs.

In Maven this is done via maven-shade-plugin:

	<plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-shade-plugin</artifactId>
		<version>2.2</version>
		<executions>
			<execution>
				<id>genesis</id>
				<phase>package</phase>
				<goals>
					<goal>shade</goal>
				</goals>
				<configuration>
					<transformers>
						<transformer
							implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
							<mainClass>com.puresoltechnologies.genesis.controller.GenesisController</mainClass>
						</transformer>
						<transformer
							implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
					</transformers>
				</configuration>
			</execution>
		</executions>
	</plugin>

The maven-shade-plugin pack a so called fat JAR. The current module and all dependencies in compile or runtime scope are unpacked and packaged into the module JAR. The additional setting for a main class specifies the class wich is started when the target JAR is started via java -jar <targetJAR> (Manifest Main-Class entry). The additional transformer specifies, that SPI services in META-INF/services are collected correctly.

As dependencies the implemented component transformators are needed which are to be run, the implemented tracker and the Genesis Controller as well:

	<dependency>
		<groupId>com.puresoltechnologies.genesis</groupId>
		<artifactId>controller</artifactId>
		<version>0.4.0</version>
	</dependency>

All dependencies need to be added in compile or runtime scope.

Fork me on GitHub