1## Cross-building
2
3RocksDB can be built as a single self contained cross-platform JAR. The cross-platform jar can be used on any 64-bit OSX system, 32-bit Linux system, or 64-bit Linux system.
4
5Building a cross-platform JAR requires:
6
7 * [Docker](https://www.docker.com/docker-community)
8 * A Mac OSX machine that can compile RocksDB.
9 * Java 7 set as JAVA_HOME.
10
11Once you have these items, run this make command from RocksDB's root source directory:
12
13    make jclean clean rocksdbjavastaticreleasedocker
14
15This command will build RocksDB natively on OSX, and will then spin up docker containers to build RocksDB for 32-bit and 64-bit Linux with glibc, and 32-bit and 64-bit Linux with musl libc.
16
17You can find all native binaries and JARs in the java/target directory upon completion:
18
19    librocksdbjni-linux32.so
20    librocksdbjni-linux64.so
21    librocksdbjni-linux64-musl.so
22    librocksdbjni-linux32-musl.so
23    librocksdbjni-osx.jnilib
24    rocksdbjni-x.y.z-javadoc.jar
25    rocksdbjni-x.y.z-linux32.jar
26    rocksdbjni-x.y.z-linux64.jar
27    rocksdbjni-x.y.z-linux64-musl.jar
28    rocksdbjni-x.y.z-linux32-musl.jar
29    rocksdbjni-x.y.z-osx.jar
30    rocksdbjni-x.y.z-sources.jar
31    rocksdbjni-x.y.z.jar
32
33Where x.y.z is the built version number of RocksDB.
34
35## Maven publication
36
37Set ~/.m2/settings.xml to contain:
38
39    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
40      <servers>
41        <server>
42          <id>sonatype-nexus-staging</id>
43          <username>your-sonatype-jira-username</username>
44          <password>your-sonatype-jira-password</password>
45        </server>
46      </servers>
47    </settings>
48
49From RocksDB's root directory, first build the Java static JARs:
50
51    make jclean clean rocksdbjavastaticpublish
52
53This command will [stage the JAR artifacts on the Sonatype staging repository](http://central.sonatype.org/pages/manual-staging-bundle-creation-and-deployment.html). To release the staged artifacts.
54
551. Go to [https://oss.sonatype.org/#stagingRepositories](https://oss.sonatype.org/#stagingRepositories) and search for "rocksdb" in the upper right hand search box.
562. Select the rocksdb staging repository, and inspect its contents.
573. If all is well, follow [these steps](https://oss.sonatype.org/#stagingRepositories) to close the repository and release it.
58
59After the release has occurred, the artifacts will be synced to Maven central within 24-48 hours.
60