Skip to content
Kyle Wilcox edited this page Oct 16, 2013 · 7 revisions

1. Installation
    a. Maven Installation
    b. External Libraries
2. Building And Packaging
    a. Building For Thredds
3. Testing
    a. Configuration
    b. Running
4. Deploying
5. Documentation
    b. Creating Javadocs

Installation

Steps for Maven installation:

  1. Download Maven
  2. Installation Instructions

Installing external, un-hosted libraries

To include any external libraries that are not hosted by a maven repo, use the following command: bash mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging> -DgeneratePom=true

Where:

  • <path-to-file> the path to the file to load
  • <group-id> the group that the file should be registered under
  • <artifact-id> the artifact name for the file
  • <version> the version of the file
  • <packaging> the packaging of the file e.g. jar

Building and Packaging

Building For Thredds

To build the ncSOS-<version>.jar you can use the following Maven command:

mvn clean package -DskipTests

As is implied, this will skip all of the sos tests and go directly to building a new jar. Tests need to be set up (code change) in order to properly run on each individual computer and broken tests will prevent Maven from fully building the target jar. The tests also can take a long time to run (close to 10 minutes), so it is recommended that you run the tests individually from packaging the jar. See below for how to setup the tests to run on a computer.

Testing

Configuration

See Test Setup

Running Tests

To run the tests you can run the Maven command below

mvn test

If you want to run a single test, for example SOSgetCapsTest.java, use the following Maven instruction

mvn test -Dtest=SOSgetCapsTest.java

Another useful option is the -X option which will print out debug logging. If this option is used, it is recommended to pipe the output to a text file (windows example):

mvn test -X > test_output.txt 2>&1

(The 2>&1 pipes stderr to stdout, which will be printed to the file).

In addition to the output of the tests, surefire creates reports in the /target/surefire-reports folder that will hold specific failures and errors for each test run.

Deployment

NcSOS is hosted on ASA's Nexus. To deploy, edit your $HOME/.m2/settings.xml file to include the username/password for deployment.

<servers>
  <server>
    <id>asa-sonatype-nexus-snapshots</id>
    <username>user</username>
    <password>pass</password>
  </server>
</servers>

Documentation

Generating Javadocs

Generating javadocs with maven is straightforward. Make sure that the pom.xml has the following set of tags defined: xml <reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.4</version> <configuration> <aggregate>true</aggregate> <quiet>true</quiet> </configuration> </plugin> </plugins> </reporting>

With the preceeding in place then simply run mvn javadoc:javadoc to generate the javadocs for the project. (It is recommended you 'clean' before generating the javadocs).