-
Notifications
You must be signed in to change notification settings - Fork 10
Developers guide
How to get started as a developer (not an end-user)
Below summary refers to Eclipse. Use of !NetBeans, etc. should be similar. The latest verified version is shown within brackets.
- Download and install Eclipse.
* You probably want to set the default encoding to UTF-8 in Eclipse for both
Eclipse -> Preferences -> General -> Workspace
and all text content types underEclipse -> Preferences -> General -> Content Types
. * You probably want to show .resource files in Eclipse. This can be changed by pressing the small down-arrow in the Package Explorer, and then clicking "Filters...". * To run Eclipse smoothly, you probably want edit eclipse.ini to set the path to the VM and set decent memory allocation settings. - Install recommended Eclipse plugins or corresponding required tools:
* Java Development Tools, if not already in place
[4.6.3]
. * Maven Integration for Eclipse, m2eclipse[1.7.0]
. - Go to the master branch of the jprime github page
https://github.com/arvestad/jprime
and click clone or download and copy the link to thejprime.git
file. - Open up a command line terminal and navigate to a suitable location and enter
git clone https://github.com/arvestad/jprime.git
- You should create your own branch so that you do not modify the master branch of jprime, this can be done by entering
git checkout -b [name_of_your_new_branch]
- Open up a new workspace in Eclipse and then select
File -> Import -> Maven -> Existing Maven Project
, now navigate to the directory where you cloned the git repo into where a Mavenpom.xml
file should be present, select it and click finish. - If you want to be able to use git integration in Eclipse you can right click on
jprime
in the Package Explorer and selectTeam -> Share Project… -> Git -> jprime.git
- Make sure you set up Eclipse to use the same version of JDK as is specified by the Maven pom.xml file (currently 1.8 at the time of writing).
- Now everything should be set up and ready to go, you can right click
jprime
in the Package Explorer and doRun As -> Maven Install
to build jprime, the compiled jprime JAR file should then end up in the target directory.
Builds are handled using the very competent (and alas complex) framework Maven. In particular, Maven takes care of all external dependencies (see also below). For creating releases, see Creating Releases.
The source file structure adheres to the Maven standard directory layout (as a subset thereof). Before adding new root folders, consider using a folder name proposed by this standard. Of particular importance are:
-
src/main/java
- where main Java source code goes. -
src/main/resources
- where peripheral files for an actual release go. -
src/main/python
- where additional Python source code goes. -
src/main/shellscript
- where additional shellscript source code goes. -
src/test/java
- where Java unit tests and test suites go. -
src/test/resources
- where peripheral files for unit tests go. -
target
- where local builds are kept (not under version control). -
lib
- where non-Mavenized dependencies are kept, see below. Furthermore, non-Java resources kan be maintained in the same manner, e.g.src/main/shellscript
and so forth.
Maven handles all external dependencies (most commonly JAR files). Typically, for a user, true Mavenized dependencies (and sub-dependencies!) are retrieved and stored under the ~/.m2
folder.
When there is a need for a new dependency, do the following:
- Try searching for it using the interface shown for
pom.xml
in the source root. If it is found, just add it. Note that current builds (as opposed to proper releases) are often denoted SNAPSHOT. - If it does not exist in an open Maven repository, one must use a workaround. Currently, this consists of adding the JAR file to the
lib
folder in the Git repository and then adding a system scope mock reference to the JAR inpom.xml
(typically without aid of the interface). - Try to add non-Javadoc dependencies. If you need Javadoc or sources, these can be collected without adding them as real project dependencies, e.g. in Eclipse by right clicking the project and selecting "Maven <- Download Javadoc".
Unit tests and test suites are handled with JUnit. Tests reside under the src/test/java
folder in a package structure aligned with that of the source code. Maven can be told to run test suites when building by setting the boolean value [true\false] in the pom.xml file.
Bug tracking is handled using the Issues page here at Github.
Logging is not handled with the built-in logger, but with Logback (included using Maven), which is a successor of log4j.
Parameter parsing can be achieved in (almost) GNU style using JCommander (included using Maven).
At the moment, ordinary XML tasks should be carried out with Java's built-in JAXB package if possible.
BioJava 4 (included using Maven) should be sufficient for common bioinformatics tasks involving alignments and similar.