-
Notifications
You must be signed in to change notification settings - Fork 106
DevelopmentGuidelines
Until recently, we have used Ant as our build tool. But we now use [Maven] (http://maven.apache.org/). Although Ant is fast and easy to use, it can be cumbersome to handle many dependencies and sub projects. For these reasons, we've transitioned to Maven. The change now automates more tasks and allows other developers easy access to our distributed jars.
Maven provides two commands for building the package. Both automatically download any jars that the S-Space package depends on before compiling.
-
mvn compile
will simply compile the source code and store the class files undertarget/classes
-
mvn package
will compile all source code and package all class files and any jars that we depend on into a single jar located undertarget
.
We note that not all of our dependencies exist as maven artifacts. To work around this, we've included a simple script add_non_maven_jars.sh
. Before building using either method above, run this command, i.e. ./add_non_maven_jars.sh
. This will install any special jars into your local maven repository.
We distrubute all our compiled jars, source jars, and javadoc jars as maven artifacts. We push out to [SonaType Nexus] (https://repository.sonatype.org/index.html#welcome) and use the following package details. To use our package in a maven project, simply add the following as a dependency:
<groupId>edu.ucla.sspace</groupId>
<artifactId>sspace</artifactId>
<version>2.0</version>
We use an extension of the [Java coding conventions] (http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html)
With regards to spacing, there are a few rules:
- No tabs should be use.
- Every indentation uses 4 spaces.
- Every class starts with a new line.
- Major code blocks should be separated with a new line.
- If a method declaration is split, the arguments should all line up.
- Indentations must be at least 4 spaces deeper than the code indentation.
- If a method declaration is split, any thows statements must be indented by 8 spaces.
- Import statements should be separated with a new line between packages and sorted based on the following ordering:
- S-Space package
- Third party Imports, in alphabetic order
- Java API imports