Build process

Ametys products are built using various components.

Each component is a project found in the Ametys Subversion repository (https://svn.ametys.org).

Ant and Ivy are the main tools used for building these components.

  1. Requirements
  2. Ivy presentation
  3. How-to build an Ametys component
    1. Checking out the component source code while keeping the subversion hierarchy
    2. Checking out the component source code without keeping the subversion hierarchy
    3. Retrieving the component source package
  4. Using an Ametys component in the Eclipse IDE

Requirements

Building an Ametys component requires:

  • JDK 1.6 or higher.
  • Apache Ant 1.7.1 or higher.
  • Subversion 1.4.0 or higher (not mandatory, this depends on the way the source code will be retrieved).

Ivy presentation

Ivy is a powerful dependency manager oriented toward Java dependency management.
Ivy is integrated with Ant, easy to use, very flexible and continuous integration ready.

The external libraries needed by Ametys products can be found at :
https://svn.ametys.org/ivyrep/external/

The configuration file needed for building Ametys products can be found at :
https://svn.ametys.org/ivyrep/ivysettings.xml

There are four possible types of build for each component :

  • release (official release, example: 1.2.3).
  • milestone (milestone or release candidates, for example: 1.2.3.20090417-0901-RC1).
  • snapshot (typically nightly builds, for example: 1.2.3.20090417-0901-r345-b232-SNAPSHOT).
  • integration (local development build, for example: 1.2.3.20090417-0901-r345-dev).

The following guide only describes integration builds.

How-to build an Ametys component

There are three ways one can build an Ametys component:

  • by checking out the component source code while keeping the subversion hierarchy.
  • by checking out the component source code without keeping the subversion hierarchy.
  • by retrieving the component source package.

In all cases, the Ivy repository needs to be checked out onto the local machine.

Checking out the component source code while keeping the subversion hierarchy

First you need to checkout the root of the Subversion repository, but not recursively (-N), since it contains all the branches, tags, ... :

$ svn co -N https://svn.ametys.org /path/to/store/svn.ametys.org
...
$ cd /path/to/store/svn.ametys.org

Then you need to checkout the ivyrep:

$ svn up ivyrep
...

Then you need to checkout a branch for the wanted component.
For the trunk of the cms project, use:

$ svn up -N trunk
...
$ cd trunk
$ svn up -N cms
...
$ cd cms
$ svn up trunk
...
$ cd trunk

You now have the cms project, you just need to call Ant in order to built and publish the artifacts.

Because dependencies on other Ametys components in trunk are of type latest.integration you need to build dependencies first.
Fortunately, if no integration build is found in your locally ivyrep, the latest nightly build will be used ( will not work offline).

The following command will build and publish the artifacts in your local ivyrep:

$ ant
Buildfile: /path/to/store/svn.ametys.org/trunk/cms/trunk/build.xml
prepare:
[mkdir] Created dir: /path/to/store/svn.ametys.org/trunk/cms/trunk/tmp
[delete] Deleting directory /path/to/store/svn.ametys.org/trunk/cms/trunk/target
...
publish:
:: delivering :: org.ametys.cms#cms;working@krusty :: 3.0.0.20090611-0849-dev :: integration :: Thu Jun 11 10:50:11 CEST 2009
delivering ivy file to /path/to/store/svn.ametys.org/trunk/cms/trunk/target/ivy/ivy.xml
remove-javadoc-publishing:
[ivy:publish] :: publishing :: org.ametys.cms#cms
[ivy:publish] published ametys-cms to /path/to/store/svn.ametys.org/ivyrep/ametys-products-integration/org.ametys.cms/cms/3.0.0.20090611-0849-dev/jars/ametys-cms-3.0.0.20090611-0849-dev.jar
...
clean:
[delete] Deleting directory /path/to/store/svn.ametys.org/trunk/cms/trunk/tmp
all:
BUILD SUCCESSFUL
Total time: 34 seconds

As artifacts are published in your local ivyrep, you can retrieve them manually or automatically with Ivy on a upstream Ivy based project.
Using the latest.integration special revision allows you to retrieve the latest successfully built local artifacts.

Checking out the component source code without keeping the subversion hierarchy

You can use this method when you want to check out only a project and you do not have access to the Subversion command line interface.

You first need to check out ivyrep from the following URL somewhere on your local machine:
https://svn.ametys.org/ivyrep/

And then checkout the branch of the component you want to build elsewhere on your local machine:
https://svn.ametys.org/trunk/cms/trunk/

Then you need to go to the directory where you have checked out this component and execute:

$ ant -Divy.settings=/path/to/locally/checked-out/ivyrep/ivysettings.xml
Buildfile: /path/to/store/svn.ametys.org/trunk/cms/trunk/build.xml
prepare:
[mkdir] Created dir: /path/to/store/svn.ametys.org/trunk/cms/trunk/tmp
[delete] Deleting directory /path/to/store/svn.ametys.org/trunk/cms/trunk/target
...
publish:
:: delivering :: org.ametys.cms#cms;working@krusty :: 3.0.0.20090611-0849-dev :: integration :: Thu Jun 11 10:50:11 CEST 2009
delivering ivy file to /path/to/store/svn.ametys.org/trunk/cms/trunk/target/ivy/ivy.xml
remove-javadoc-publishing:
[ivy:publish] :: publishing :: org.ametys.cms#cms
[ivy:publish] published ametys-cms to /path/to/store/svn.ametys.org/ivyrep/ametys-products-integration/org.ametys.cms/cms/3.0.0.20090611-0849-dev/jars/ametys-cms-3.0.0.20090611-0849-dev.jar
...
clean:
[delete] Deleting directory /path/to/store/svn.ametys.org/trunk/cms/trunk/tmp
all:
BUILD SUCCESSFUL
Total time: 34 seconds

The ivy.settings ant property must be the path to the ivysettings.xml file previously checked out.

Retrieving the component source package

This method is very similar to the previous one.
Indeed, you also need to first check out the ivyrep into a given directory.

Then, you need to retrieve the source package from http://releases.ametys.org/ and untar it:

$ tar zxvf ametys-cms-1.2.3.tar.gz
...
$ cd ametys-cms-1.2.3

Finally you need execute:

$ ant -Divy.settings=/path/to/locally/checked-out/ivyrep/ivysettings.xml
Buildfile: /path/to/store/svn.ametys.org/trunk/cms/trunk/build.xml
prepare:
[mkdir] Created dir: /path/to/store/svn.ametys.org/trunk/cms/trunk/tmp
[delete] Deleting directory /path/to/store/svn.ametys.org/trunk/cms/trunk/target
...
publish:
:: delivering :: org.ametys.cms#cms;working@krusty :: 3.0.0.20090611-0849-dev :: integration :: Thu Jun 11 10:50:11 CEST 2009
delivering ivy file to /path/to/store/svn.ametys.org/trunk/cms/trunk/target/ivy/ivy.xml
remove-javadoc-publishing:
[ivy:publish] :: publishing :: org.ametys.cms#cms
[ivy:publish] published ametys-cms to /path/to/store/svn.ametys.org/ivyrep/ametys-products-integration/org.ametys.cms/cms/3.0.0.20090611-0849-dev/jars/ametys-cms-3.0.0.20090611-0849-dev.jar
...
clean:
[delete] Deleting directory /path/to/store/svn.ametys.org/trunk/cms/trunk/tmp
all:
BUILD SUCCESSFUL
Total time: 34 seconds

Here again the ivy.settings ant property must be the path to the ivysettings.xml file previously checked out.

Using an Ametys component in the Eclipse IDE

Required plugins :

Configuring IvyDE for Ametys :

  • check out the ivyrep as a new eclipse project
  • configure IvyDE to use the correct settings :
    • go the Window > Preferences menu.
    • select Ivy > Settings and browse to select the ivysettings.xml previously checked out.

Using a new Ametys component :

  • check out the component you want to use as a new Java project.
  • add the Ivy classpath to the component :
    • right click on the ivy.xml file in the component's project and choose Add Ivy Library.
      or
    • go to the Properties tab of the component's project and into Build Path > Librairies.
    • click on Add library and select IvyDE Managed Dependencies.
    • choose all configuration ([*]).
  • Your java project should now contain an Ivy classpath (ivy.xml [*]) and build successfully :

Back to top