Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The software is currently compatible with Java versions 1.7 8 and greater.  It will not currently build with Java 1.6 7 or other earlier versions.  You need to download the "Java Platform (JDK)" and not just the JRE.  It should work with Java 1.8 releases.

The bundle for your system should be downloaded from the Java SE downloads site.  Then you need to follow the setup instructions listed there.

...

No Format
export JAVA_HOME=/path/to/java/jdk
export PATH=$JAVA_HOME/bin:$PATH

#for example on rhel6-64 machine @ slac:
export JAVA_HOME=/afs/slac/package/java/amd64_linux/jdk1.8.0_101/
export PATH=$JAVA_HOME/bin:$PATH

...

No Format
[$] javac -version
javac 1.78.0_17101

If this command prints "command not found", the current PATH variable probably does not contain the Java bin directory or the location was set incorrectly.

Info
titleJava on OSX - DEPRECATED

On OSX, the Java configuration found by Maven can sometimes conflict with what is shown by the 'java -version' from the command line.  In particular, the Java version that comes bundled with the operating system might be 1.6 when a 1.7 JDK is required to build HPS software.

In order to fix this, setup the JAVA_HOME variable as follows:

export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)

Of course, a valid Java 1.7 JDK installation must be present for this to work. You can get the latest version from here.

Simply install the DMG file as normal, and then setting up your environment as above should configure your machine successfully for Maven usage.

...

If this command does not work, then you should check that the PATH variable is set correctly.

...

Git

Info
titleSubversion Git on your system

Subversion Git is a common tool on Unix systems, and it is likely already installed for you to use.  If not, then check with your system administrator about installing it.

Subversion Git is the source control system system used to obtain the source code from a remote server.  You will need the Subversion Git client tool in order to checkout the HPS Java code.

Subversion should not be compiled from source code.  It is probably best to either have your local administrator install it if it is not present already, or you can use your package manager (like yum on Redhat systems).

This is an example of using your package manage to do thisinstall git, assuming it is not already present.

No Format
sudo yum install subversiongit

Windows users can install the TortoiseSVN tool, but its usage is not covered in these instructionsmay also want to install a graphical client such as TortoiseGit.

Build Instructions

Obtaining the Source Code

...

No Format
mkdir /work/hps
cd /work/hps

You will now use the svn git command to checkout the trunk"master", or main development branch, of the HPS Java Project.

No Format
svngit checkoutclone svnhttps://svngithub.freehep.org/hps/java/trunk com/JeffersonLab/hps-java-trunk.git

This may take awhile as the source code is downloaded from the server.

...

When introducing local changes to the trunk, you may get error messages like "You have 2 Checkstyle violations." and the build will fail.

...

Firstly, tabs are disallowed completely in all modules but usersJava code.  

An error message like this will show if you have tabs in one of your files.

...

When developing, you will typically want to check periodically that relevant integration tests pass.

Integrated Test Output

The integration tests run the full reconstruction, plus simple analysis modules. These produce histograms, which are then compared to a set of reference histograms. Any differences cause the tests to fail, requiring human intervention to decide whether the changes are acceptable. In that case the reference histograms will be updated to reflect the new state of the reconstruction/analysis.

Running the Distribution Jar

The primary tool produced by the installation is a standalone, runnable jar file that can be used along with XML steering files to run reconstruction or analysis jobs.

In order to test the installation, you may execute a command such as the following, where VERSION is replaced by your actual version from the last successful build.

...

The Maven tool will also install this file into your local repository.  This

Here is an example of running the bin jar from your its location in the local repository directory.

No Format
java -jar ~/.m2/repository/org/hps/hps-distribution/3.0.3-SNAPSHOT/hps-distribution-3.0.3-SNAPSHOT-bin.jar

...


Running HPS Java
describes in much greater detail how to run various command line tools in HPS Java using the distribution jar.

...

As an alternative to the above instructions for building the software locally, you may also download and run the a distribution jars jar from a the Nexus repository.

This search URL will show the most recent release list of releases of the distribution jar that can be downloaded.  You can   Select the version that you are interested in and simply click on the "bin jar" link for the distribution version you want to download, save it to your machine, and run it using the previous instructions.

You can may also directly download a jar using (rather ugly) URLs like this which should work in tools like wget.

...

Code Block
languagebash
wget "http://srs.slac.stanford.edu/nexus/service/local/artifact/maven/redirect?r=repository/lcsim-maven2-releases&g=org.hps&a=hps-distribution&v=3.6&e=jar&c=binsnapshot/org/hps/hps-distribution/4.4-SNAPSHOT/hps-distribution-4.4-20190612.032534-24-bin.jar" -O hps-distribution-34.64-bin.jar

This The above example command will save the 3latest 4.6 4 distribution jar as the file hps-distribution-34.64-bin.jar in  in the current directory.

Resolving Maven Dependencies

Maven is able to resolve project dependencies by downloading jar files from remote repositories.  In order to do this, it must know about the locations of these jars, or local builds can fail with errors about missing dependencies.

This should not be a problem when building the entire trunk  But errors may occur when building individual modules, if the parent POM has not already been installed locally beforehand.

There are several different ways to resolve these kinds of issues, and generally only one will be needed:

  1. Install the entire set of modules locally by building the trunk.
  2. Checkout and build the parent module at svn://svn.freehep.org/hps/java/trunk/parent which contains the remote repository locations.
  3. Add the remote repository to your global Maven settings file.

The third option entails adding the remote repository information to a local settings file that will apply to all your local Maven builds.

In order to do this, the following XML can be put into the file ~/.m2/settings.xml which you should create if it does not exist already:

Example Settings for Dependency Resolution

No Format
<?xml version="1.0"?>
<settings>
    <profiles>
        <profile>
            <id>yourNameHere</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <repositories>
                <repository>
                    <id>lcsim-maven</id>
                    <name>org.lcsim Maven Repository</name>
                    <url>http://srs.slac.stanford.edu/nexus/content/groups/lcsim-maven2-public/</url>
                </repository>
            </repositories>
        </profile>
    </profiles>
</settings>

The above configuration will allow Maven to check the repository used by HPS whenever it looks for dependencies during a build.

Maven Repos

The following Maven repositories provide the the jar dependencies for HPS Java, which are not found in Maven central.

Freehep Repository

 

Code Block
languagexml
<repository>    
    <id>freehep-repo-public</id>
    <name>FreeHEP Maven Public</name>
    <url>http://srs.slac.stanford.edu/nexus/content/groups/freehep-maven2-public/</url>
</repository>

LCSim Repository

 

Code Block
languagexml
<repository>
    <id>lcsim-repo-public</id>
    <name>LCSIM Public Maven Repository</name>
    <url>http://srs.slac.stanford.edu/nexus/content/groups/lcsim-maven2-public/</url>
</repository>

 

CODA Repository

 

...

languagexml

...