The Foundation hosts several Java projects already and provides a good level of support for building, testing and releasing Java code.
...
Below are listed some of the most common processes that are involved in a Java project lifecycle and how they interact with the project infrastructure provided by the Foundation.
Table of Contents |
---|
Build
The build process aims to produce reusable Java binaries (in Maven terms, artifacts) in a reliable and reproducible way, from every contributor or consumer workstation; special build requirements should be documented in the project homepage.
The Maven command to build artifacts is mvn package.
Artifact publishing
All Java project projects hosted by the Foundation are expected to use a groupId that is (or prefixed by) org.symphonyoss and finos.<program name> and are published on the Central Repository (also known as Maven Central)
...
- Sign up on https://issues.sonatype.org ; using / (note that this site uses the same credentials (id/password), you can access as http://oss.sonatype.org
Create an ODP Enable CI issue following the JIRA Template reported below
Code Block h4. Project coordinates <_github project url and other useful info_> h4. Sonatype JIRA ID <_The username created on step #1 that grants you access to https://issues.sonatype.org and http://oss.sonatype.org_>/).title Enable CI JIRA Template collapse true - Raise a HELP issue or send an email to
help@finos.org
, with the GitHub URL of your project, and your Sonatype Jira ID (from step 1) Locate (or create) and edit the settings.xml file in your local file-system to add a <server> item; using Maven encrypted passwords is strongly advised, to avoid setting up the password in clear text
Code Block title settings.xml linenumbers true collapse true <settings> <servers> <server> <id>ossrh</id> <username>your<username>[your-sonatype-jira-id<id]</username> <password>your<password>[your-sonatype-jira-pwd<pwd]</password> </server> <server> <id>ossrh-distro</id> <username>your<username>[your-sonatype-jira-id<id]</username> <password>your<password>[your-sonatype-jira-pwd<pwd]</password> </server> </servers> </settings>
At this point, you can proceed with the deployment of the snapshot artifacts, by simply invoking mvn deploy
from the project root folder; as a result, artifacts will be publicly available on oss.sonatype.org and usable by anyone as Maven dependencies.
...
Code Block | ||
---|---|---|
| ||
[![Maven Central](https://img.shields.io/maven-central/v/org.finos.symphonyoss/symphonyoss<program name>/<project name>.svg?maxAge=2592000)](http://search.maven.org/#artifactdetails%7Corg.symphonyoss%7Csymphonyoss%7C2%7Cpom.finos.<program name>%7C<project name>%7C2%7Cpom) |
This will appear as follows and link to the artifact on search.maven.org
...
If you want to run this process continuously for each commit, you can integrate with Travis CI or other Continuous Integration systems.
Release
The Maven release process performs the following activities:
...
At this point you can proceed with the release:
export GPG_TTY=$(tty)
- Run the maven command
mvn release:prepare release:perform -
PreleasePrelease
; the release profile will provide javadocs, sources and gpg signature configuration for the build; if you're not using ssf-parent-pom, you'd need to configure these plugins by yourself (this pom.xml may be useful) - Promote the staged artifacts by accessing the Nexus staging repositories to:
- Identify which repository refers to the release process performed on step #1. Look at the description column to identify the specific project (look towards bottom of list).
- Select the staging repository. To release the request, click the Close (button on top menu) the release request - this operation will trigger a validation of the artifacts to be released
- Click on the refresh button to update status of repository. Click on Release (button on top menu) to sync artifacts with the Central Repository and remove staging repository.
Upon release, your component will be published to Central: this typically occurs within 10 minutes, though updates to search can take up to two hours. You can also watch this youtube video to know more about the Nexus staging lifecycle.
Known issues
If the release command fails with "gpg: signing failed: Inappropriate ioctl for device", run the following command and try again; more info on stackexchange.
export GPG_TTY=$(tty)
...
Using service Artifact Listener, we are currently notifying dev-notify@symphony.foundation for every release of the Foundation projects on the Central Repository ; anyone can sign up and customise their notifications.
Documentation
Maven allows to generate a documentation website in HTML format and provides different options to publish such content on remote servers; content is composed by:
...
The SSF Parent POM provides a configuration configuration that allows to publish such content on symphonyoss.github.io after the site creation phasethe Symphony Program's GitHub Pages; to enable it, the build must be invoked using the -Ppublish-site Maven profile enabled; for switch. For more info, follow the SSF Parent Pom documentiondocumentation and check the Symphony Program's symphony-java-sample-bots project.