Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.
Ingvord edited this page Aug 28, 2019 · 22 revisions

Welcome to the JTango wiki!

How to resolve dependencies using maven

There is no need to do anything extra - maven resolves dependencies by its own. If though there are still some problems to do that consider to add this code snippet to your $HOME/.m2/settings.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<settings xsi:schemaLocation='http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd'
          xmlns='http://maven.apache.org/SETTINGS/1.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
    
    <profiles>
        <profile>
            <repositories>
                releae_1<repository>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                    <id>bintray-tango-controls</id>
                    <name>bintray</name>
                    <url>http://dl.bintray.com/tango-controls/maven</url>
                </repository>
            </repositories>
            <id>bintray</id>
        </profile>
    </profiles>
    <activeProfiles>
        <activeProfile>bintray</activeProfile>
    </activeProfiles>
</settings>

This adds Tango bintray maven repository to the maven so it can fetch dependencies from it.

How to build and install localy

During the development it is useful to build and install localy. For this use the following commands:

To build a package, i.e. jar: mvn clean package. If everything is okay you should see SUCCESS in the output. The resulting package will be in the target (typically $PROJECT_ROOT/target) directory.

To install a package into a local maven repo ($HOME/.m2/repository by default): mvn clean install

To build a multi module project execute the commands mentioned above in the root of the project. Each module can be build and/or installed independently, using commands mentioned above in the corresponding module directory.

How to release

OUTDATED! How to release using maven:release plugin

How to release using maven:release plugin

To perform release you must have write permission on tango-controls/REPO and your ssh key uploaded to github (profile->settings->ssh and gpg keys).

First create a clean local copy of the repository: git clone . release. Go inside (cd release). Execute mvn release:prepare, it will ask for the release version (default is current version without -SNAPSHOT); tag name for the remote repository; next development version (default is release verion +1 -SNAPSHOT). In many cases just press enter for each question.

Next command will deploy the built artifacts (pom.xml, .jar, -sources.jar) to the Tango bintray maven repository. But before doing that make sure you have the following code snippet in your settings.xml ($HOME/.m2/settings.xml):

<servers>
  <server>
      <id>bintray-tango-controls</id>
      <username>YOUR_BINTRAY_USERNAME</username>
      <password>YOUR_BINTRAY_API_KEY</password>
  </server>
</servers>

This allows maven to upload artifacts onto bintray. For this you must be in the tango-controls organization on bintray. Api key can be found in profile->Edit Profile->API Key.

Once this is checked execute mvn release:perform. This builds the jars and uploads them to bintray. The resulting jars can be found in target/checkout/{module}/target.

Go up cd .. and synchronize your local git repo with the origin: git pull or the upstream in case of fork (git pull --rebase upstream master)

Uploading JTango fat jar

JTango has a module (assembly) that aggregates all the other modules into a single fat jar.

During release this fat jar is uploaded to bintray generic repo. Depending on the current branch (master VS jtango-9-lts) fat jar goes either to JTango or JTango-9-LTS packages.

To correctly upload the file make sure that ${bintray.user.name} and ${bintray.user.apikey} properties are correctly resolve during deploy phase. For this add the following to your ~/.m2/settings.xml

<activeProfiles>
        <activeProfile>bintray</activeProfile>
    </activeProfiles>
<profiles>
        <profile>
            <id>bintray</id>
            <activation>
                <property>
                    <name>release</name>
                </property>
            </activation>
            <properties>
                <bintray.user.name>YOUR_BINTRAY_USERNAME</bintray.user.name>
                <bintray.user.apikey>YOUR_BINTRAY_APIKEY</bintray.user.apikey>
            </properties>

        </profile>
</profiles>

Release by tagging this repo

Since #68 to perform a release one just need to tag this repo:

Set new version:

The version should be only numeric e.g. 9.5.17. Typically the version is what is in parent/pom.xml#version without -SNAPSHOT.

Once tag has been set Travis starts a build sequence. In the deploy artifacts stage it will perform maven deploy -Prelease to deploy artifacts to bintray and will upload JTango fat jar to GitHub release. It will also increment the version and commit it into the main branch:

Validate everything:

  1. bintray has *.pom, *.jar, *-sources.jar and *-javadoc.jar files for each package:

  2. JTango fat jar has been uploaded:

Edit release and hit publish button:

Update Javadoc links in README.md:

[![Javadocs](https://www.javadoc.io/badge/org.tango-controls/JTangoServer/9.5.17.svg?color=yellowgreen&label=JTangoServer)](https://www.javadoc.io/doc/org.tango-controls/JTangoServer/9.5.17)
/-------------------------------------------------------------------------^
/--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^

Now new release is ready to be synced with maven central.

How to sync with maven central

Once JTango has been successfully released aka command line output looks like this:

...
[INFO] Cleaning up after release...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] JTangoParent ...................................... SKIPPED
[INFO] JavaTangoIDL ...................................... SKIPPED
[INFO] Java common ....................................... SKIPPED
[INFO] Java DAO .......................................... SKIPPED
[INFO] JTango Client Lang ................................ SKIPPED
[INFO] JTango Server ..................................... SKIPPED
[INFO] JTango full assembly .............................. SKIPPED
[INFO] JTango ............................................ SUCCESS [5:25.444s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5:25.963s
[INFO] Finished at: Sat Oct 21 18:17:32 MSK 2017
[INFO] Final Memory: 14M/483M
[INFO] ------------------------------------------------------------------------

If you want to synchronize JTango with maven central go to bintray:

Iterate over each package (7 in total) and perform Maven Central:

For this you will need to provide your sonatype user name and password. To get one please:

  1. create a sonatype JIRA account: link.
  2. create an issue in similar to this one in OSSRH JIRA Project with a description like "Please allow my user to publish tango-controls.org artifacts". The already allowed maintainers will comment and the administrator will grant you the privileges to publish tango-controls artifacts on MAVEN Central.

The Good response looks like this:

Note that it is not mandatory to close and commit the repo (see checkbox). But do not forget to do so when the last artifact will be synchronized.

After a few douzen of minutes newly released artifacts will be available in maven central:

Follow this link to check the result

References

Performing release with GitHub, maven release plugin and bintray