This is an archive of the old MediaWiki-based ImageJ wiki. The current website can be found at imagej.net.

Developing ImgLib2

ImgLib2
Topics
Overview
Benchmarks
FAQ
Tutorials
Getting Started
Accessors
Accessibles
ImgLib2 Examples
Introductory Workshop
Advanced Programming Workshop
Into ImgLib - Generic Image Processing in Java
Creating Imglib2 images in MATLAB
Development
Developing ImgLib2
ImgLib2 Discussion

Introduction

The ImgLib2 library uses Maven to manage project dependencies. One advantage of this approach is nice integration with various development environments (IDEs).

Because people tend to have differing IDE configurations, we do not put project metadata files (e.g., .classpath, .project and .settings for Eclipse) into the git repository. Instead, the IDE can use Maven's pom.xml file directly to manage your dependencies in a better way.

Getting the code

You can clone the ImgLib2 code using Git with the URL: git://github.com/imglib/imglib2

Developing ImgLib2 with Eclipse

To develop ImgLib2 in Eclipse, follow these steps:

  1. Install the Maven plugin
  2. Choose File  › Import from the Eclipse menu
  3. Select "Existing Maven Projects" and click Next
  4. For the Root Directory, specify the path where you cloned ImgLib2
  5. From the projects list, leave all items checked
  6. Click Finish

For fresh installs, it will initially take some time (a few minutes) for Maven to download all the dependencies for both its own plugins, and for ImgLib2. This is a one-time cost. After that, Maven will check for module updates once a day, which is generally fast.

Once you have the ImgLib2 projects within Eclipse, you can reap the benefits of the improved dependency management. For example, if you have the imglib2 and imglib2-algorithms projects open, the imglib2-algorithms project will have an Eclipse project build dependency on imglib2. If you then close the imglib2 project, the dependency within imglib2-algorithms with automatically become a library dependency to imglib2-2.0-SNAPSHOT.jar, rather than the project.


Developing ImgLib2 with IDEA

IntelliJ IDEA comes with built-in support for Maven.

See Developing ImageJ in IntelliJ IDEA.


Developing ImgLib2 with NetBeans

NetBeans comes with built-in support for Maven.

See Developing ImageJ in NetBeans.

Developing ImgLib2 with command line tools

You can use the mvn command line tool to build ImgLib2. Just type "mvn" with no arguments. By default, Maven will compile the code, run unit tests, create a JAR file and install it in your local Maven repository (typically found in ~/.m2/repository). Maven does its work in a subfolder called target which is where you'll find compiled classes and JAR artifacts.

For more on using the Maven command line tool, see Building a Project with Maven on the Maven web site.