# Developer doc

# Building from source

To build Ivy from source it's really easy.

## Requirements

All you need is

- an svn client
to check out Ivy sources from apache svn, not required if you build from sources packaged in a release
- Apache Ant 1.6.0 or greater
We recommend either ant 1.6.5 or 1.7.0
- junit 3.8.2 jar in your ant lib
this is not required if you use ant 1.7
- a jdk 1.5 or greater
Build instructions have been successfully tested with sun jdk 1.5.0 and 1.6.0

## Procedure

### Get the source

You can either get the sources from a release, or get them directly from svn. For instance, to get the trunk version:

    svn co https://svn.apache.org/repos/asf/ant/ivy/core/trunk ivy

### Build

Go to the directory where you get the Ivy sources (you should see a file named build.xml) and run:

    ant

### Check the result

The ant build will compile the core classes of Ivy and use them to resolve the dependencies (used for some optional features). Then it will compile and run tests with coverage metrics.
If everything goes well, you should see the message

    BUILD SUCCESSFUL

Then you can check the test results in the build/doc/reports/test directory, the jars are in build/artifacts, and the test coverage report in build/doc/reports/coverage

# Coding conventions

The Ivy code base is supposed to follow the standard java conventions:
http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html
This is a work in progress though (see IVY-511), but patches helping migration to these conventions are welcome.

# Developing with eclipse

Even though you can develop Ivy with your IDE of choice, we support eclipse development by providing ad hoc metadata.
We currently provide two options:

## Eclipse alone

To develop with a simple eclipse install all you need is eclipse 3.1 or greater, with no particular plugin.
First call the following ant target in your Ivy workspace:

    ant eclipse-default

This will resolve the dependencies of Ivy and produce a .classpath using the resolved jars for the build path.
Then you can use the "Import->Existing project into workspace" eclipse feature to import the Ivy project in your workspace.

## Eclipse + IvyDE

You can also leverage the latest IvyDE version to be able to easily resolve the ivy dependencies from Eclipse.
To do so all you need is call the following ant target in your Ivy workspace:

    ant eclipse-ivyde

or if you don't have ant installed you can simply copy the file .classpath.ivyde and rename it to .classpath
Then you can import the project using "Import->Existing project into workspace" as long as you already have latest IvyDE installed.
To install latest IvyDE version compatible with the latest Ivy used to resolve Ivy dependencies, you will need to use a snapshot build, not endorsed by the ASF, available here:
http://people.apache.org/~xavier/ivyde/snapshot/
Download the file and unzip its content in your eclipse installation directory.

## recommended plugins

The Ivy project comes with settings for the checkstyle plugin we recommend to use to avoid introducing new disgression to the checkstyle rules we use.
If you use this plugin, you will many errors in Ivy. As we said, following strict checkstyle rules is a work in progress and we used to have pretty different code conventions (like using _ as prefix for private attributes), so we still have things to fix. We usually use the filter in the problems view to filter out checkstyle errors from this view, which helps to know what the real compilation problem are.
Besides this plugin we also recommend to use a subversion plugin, subversive or subclipse being the two options currently available in the open source landscape.