Versions Compared

Key

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

...

Create a directory for your project and go into it.

No Format
mkdir myProjectExampleProject
cd myProjectExampleProject

Now, create a directory for your source files, including directories for the org.lcsim base package.

...

Customize the following information in project.xml for your project.

No Format
<artifactId>myProject<<artifactId>ExampleProject</artifactId>
<currentVersion>0.1</currentVersion>
<organization>
  <name>Example Organization</name>
  <url>http://www.example.org</url>
</organization>
<description>This is an example Maven project.</description>
<shortDescription>Example Maven project</shortDescription>
<url>http://www.example.org/myProject<ExampleProject</url>
<issueTrackingUrl>http://www.example.org/myProjectExampleProject/bugs</issueTrackingUrl>
<repository>
  <connection>scm:cvs:pserver:anonymous@cvs.example.org:/cvs/example:myProject<ExampleProject</connection>
</repository>
<name>myProject<<name>ExampleProject</name>
<inceptionYear>2005</inceptionYear>

The After the project information, the following lines should be inserted into project.xml to make it depend on org.lcsim, itself.

...

Basic Build Command

The project can be build built from the command line with this simple command.

No Format
maven

This builds creates the default jar target, installing project JARs JAR file and installs it into the ~/.maven/repository directory under lcsim.

Alternately, you can use the Netbeans IDE to build your Maven-based projects.

Run Plugin

The FreeHep Run Plugin can generate a run script for your project.

...

No Format
<dependency>
  <groupId>freehep</groupId>
  <artifactId>freehep-run-plugin</artifactId>
  <version>1.1.1</version>
  <url>http://java.freehep.org/maven/freehep/plugins</url>
  <type>plugin</type>
</dependency>

Maven also needs to know what class to be executed by the run script. This goes into the project.properties file.

No Format
maven.jar.mainclass=myorg.lcsim.example.classpath.myMainExampleMain

To build the script, execute the following target.

...

A run script named after your project should now be placed into found in the bin directory.

This script sets up the classpath and executes the main function of the specified class.

...

The script can be run from the current directory, as follows.

No Format
./bin/myProjectExampleProject [args]

The command line syntax of the script is completely up to you.

...

When JAS loads, it will automatically load this JAR, making your project classes available from within JAS, itself.

Build Script

A full build command for your project could be , incorporating all of the features from above, would look something like this.

No Format
maven -Dmaven.test.skip=true -Drun.install=$(pwd) clean jar:install jas:install run:install

This will do a clean build, skipping tests, and installing the run script to the current directory. It also puts the JAR files into the ~/maven/repository area and ~/.JAS3/extensions directories.