////
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
   distributed with this work for additional information
   regarding copyright ownership.  The ASF licenses this file
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
   with the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   KIND, either express or implied.  See the License for the
   specific language governing permissions and limitations
   under the License.
////

== Building from source

To build Ivy from source it's really easy.

=== Requirements

All you need is

* a link:https://git-scm.com/downloads[Git] client +
_to check out Ivy sources from Apache Git, not required if you build from sources packaged in a release_

* link:https://ant.apache.org/[Apache Ant] 1.9.0 or greater +
_We recommend the latest version of Ant_

* a link:http://www.oracle.com/technetwork/java/javase/downloads/index.html[JDK] 7 or greater +
_Build instructions have been successfully tested with Oracle JDK 7 and 8_

=== Procedure

==== Get the source

You can either get the sources from a release, or get them directly from Git:

[source,shell]
----
git clone git://git.apache.org/ant-ivy.git
----

==== Build

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

[source,shell]
----
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:

[source,shell]
----
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 Java Code Conventions:
http://www.oracle.com/technetwork/java/javase/documentation/codeconvtoc-136057.html

This is a work in progress though (see link:https://issues.apache.org/jira/browse/IVY-511[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 4.2 or greater, with no particular plugin.
First call the following Ant target in your Ivy workspace:

[source]
----
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:

[source]
----
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:
https://builds.apache.org/view/A/view/Ant/job/IvyDE/

Download the file and unzip its content in your Eclipse installation directory.

=== Recommended plugins

The Ivy project comes with settings for the link:http://eclipse-cs.sourceforge.net/[Checkstyle plugin] we recommend to use to avoid introducing a new digression to the Checkstyle rules we use.
If you use this plugin, you will see 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 Git plugin, link:https://www.eclipse.org/egit/[EGit].
