Versions Compared

Key

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

Creating a Maven Project that Depends on org.lcsim

Overview

The Maven can be used as the build system for your project tool is used to build the org.lcsim software. It automates most of the low-level details of dependencies and building for Java projects. For instance, it can automatically download external JARs required by your project . The org.lcsim project uses this tool for its build system, as wellbased on a repository URL. Additionally, it can build a complete project website including source code metrics, cross-reference, and JavaDocs.

This tutorial shows how to create a Maven project that depends on org.lcsim, so that your code can seemlessly access this framework and all of its dependencies.

Tip
titleSource Control

It is always a good idea to store your projects in a source control system, such as CVS. Contact your local system administrator for instructions on setting up a module for your project.

Example Maven Project

The SLAC LCD cvs If you want to get started quickly without worrying about the details, the SLAC CVS contains a sample Maven project called ExampleMavenProject, which that can be checked-out with this command.

No Format
cvs -d :pserver:anonymous@cvs.freehep.org:/cvs/lcd co ExampleMavenProject

This project is "ready to go" and can be used as a template.

To build it the example project from the command-line, assuming there is an sh shell available, e.g. on Linux, Cygwin, etc.

...

Now you are ready to experiment with your own Maven project. Any Java code placed into src or test should be able to access all the classes of the org.lcsim framework and its dependencies.

To use the example project as a template, simply replace the "ExampleMavenProject" string with the actual name of your own project in project.xml.

The remaining portion of this tutorial covers how to make a Maven/org.lcsim project from scratch, in case you are wondering about the details.

...

Create a directory for your new project and go into it.

No Format
mkdir ExampleProject
cd ExampleProject

...

The project's root directory needs to should contain three Maven configuration files.

  • project.xml - main configuration file, listing the project's core information and its dependencies
  • maven.xml - Maven settings, such as the default build target
  • project.properties - project properties file, including source repository locations, e.g. freehep.org

These files can be obtained from org.lcsim's root directory.

...

No Format
<dependency>
  <groupId>lcsim</groupId>
  <artifactId>lcsim</artifactId>
  <version>0.9</version>
  <url>http://www.lcsim.org</url>
</dependency>
Warning
titleorg.lcsim version

Maven requires a specific version tag for dependencies. This means that the version string needs to updated when a new org.lcsim release is made, or the older version will be used instead.

The org.lcsim JAR is not currently maintained as a downloadable dependency. Each project user needs to compile and build this program themselves in order to install it to the local repository.

...