Hosted by Three Crickets

Sincerity
Packaging and Bootstrapping
For the JVM

Please note that Sincerity is still under development and that this documentation is incomplete.

Sincerity logo: jackrabbit and flowers

Packaging

There are two main reasons you would want to create Sincerity packages:
  1. You've created a useful skeleton, skeleton add-on or plugin, which you would like to share with others for use in their Sincerity containers. A package, of course, is the most natural way to do so. You could then host your package on your own repository, or submit it for inclusion in other public repositories.
  2. Packages are very useful for deploying your application internally, especially in ephemeral "cloud" environments. Programmers working on different modules could package their results, using a clear versioning system. You would then host the packages in your own private repository, using Nexus or even a plain directory. Deployment, including upgrades, would thus involve nothing more than running "sincerity install" on the relevant containers. It also allows easy downgrading of applications, or setting modules to specific versions for testing and debugging.
Note that "packaging" here refers specifically to creating Sincerity packages, which you can then install into Sincerity containers as dependencies. If what you want is to distribute the entire container, then see the Distribution Plugin, and also the Sincerity Runtime Plugin.

The Sincerity Packaging Plugin

…does not exist yet, as of Sincerity 1.0. This is something on our roadmap, and technically entirely viable. The idea is to allow for a friendly GUI, as well as a strong CLI.
Until then, you can use Maven, as detailed below. It's slightly awkward, in that it requires editing complex XML files, but for the purpose of creating simple packages it should be very straightforward.

How to Create a Sincerity Package Using Maven

It's relatively easy to use Apache Maven to create a Sincerity package, with the help of the maven-assembly-plugin.
You can start with the following "pom.xml" file as a skeleton:
<?xml version="1.0" encoding="UTF-8"?>
<project
	xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
​
	<groupId>org.myorg.myapp</groupId>
	<artifactId>myapp</artifactId>
	<version>1.0.0</version>
	<packaging>pom</packaging>
​
	<name>My Cool Application</name>
	<description>This is an application packaged for use with Sincerity.</description>
​
	<dependencies>
		<dependency>
			<groupId>com.threecrickets.savory</groupId>
			<artifactId>savory-framework</artifactId>
			<version>1.0-beta1</version>
		</dependency>
	</dependencies>
​
	<build>
		<directory>cache</directory>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-assembly-plugin</artifactId>
				<version>2.2.1</version>
				<executions>
					<execution>
						<id>jar</id>
						<phase>package</phase>
						<goals>
							<goal>single</goal>
						</goals>
						<configuration>
							<appendAssemblyId>false</appendAssemblyId>
							<archive>
								<manifestEntries>
									<Package-Folders>package</Package-Folders>
								</manifestEntries>
							</archive>
							<descriptors>
								<descriptor>package.xml</descriptor>
							</descriptors>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</project> 
Some things you'll want to customize:
You will also need to create a "package.xml" file in the same directory:
<?xml version="1.0" encoding="UTF-8"?>
<assembly
	xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
​
	<id>jar</id>
	<formats>
		<format>jar</format>
	</formats>
	<baseDirectory>package</baseDirectory>
	<fileSets>
		<fileSet>
			<directory>path-to-package</directory>
			<outputDirectory>.</outputDirectory>
			<includes>
				<include></include>
			</includes>
		</fileSet>
	</fileSets>
</assembly>
You'll want to change "path-to-package" to point to the base of your distribution directory. Note that it is relative to the location of "package.xml" file, and must have the final directory structure you want in the Sincerity container into which your package will be installed.
Note that you can create much more complex <fileSets> than this one. Consult the assembly descriptor format documentation for more information.
You can now build and deploy your package into a local file repository by running the following Maven command from the directory in which you have your "pom.xml" file:
mvn deploy -DaltDeploymentRepository=myrepo::default::file:/path-to-local-repository/
Note that if this is the first time you've run Maven, it will take some time to download all the necessary plugins it needs. Consequent runs will be much faster.
Of course, you can also deploy to a repository server, such as Nexus, which you can easily install with Sincerity's Nexus skeleton. You can also configure Maven to always use a default target repository for deployment.
Maven is a complex tool that can do a whole lot more than this, but this should get you started.
[TODO: Add note about support for -SNAPSHOT]

The Sincerity Manual is provided for you under the terms of the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. The complete manual is available for download as a PDF.

Download manual as PDF Creative Commons License