# Building Acegi Security System

## Checking Out from CVS

This project uses Maven as project manager and build tool. We recommend you to install Maven 1.0.2 or greater before trying the following. Note there are workarounds at the bottom of this page.

To checkout Acegi Security from CVS, execute the following command on a single line:

    maven scm:checkout-project
        -Dmaven.scm.method=cvs
        -Dmaven.scm.cvs.module=acegisecurity
        -Dmaven.scm.cvs.root=:pserver:anonymous@cvs.sourceforge.net:/cvsroot/acegisecurity
        -Dmaven.scm.checkout.dir=acegisecurity

See our CVS Usage page for other CVS access options.

## Quick Build

Often people reading this document just want to see if Acegi Security will work for their projects. They want to deploy a sample application, and that's about it (after all, all the reference documentation can be read online at http://acegisecurity.sourceforge.net). In this case, execute:

    cd $ACEGI_SECURITY/core

    maven jar:install

    cd $ACEGI_SECURITY/samples/contacts

    maven multiwar:multiwar

    copy $ACEGI_SECURITY/samples/contacts/target/acegi-security-sample-contacts-filter.war $YOUR_CONTAINER/webapps

Then load up your web container and visit http://localhost:8080/acegi-security-sample-contacts-filter/ (or whatever location is appropriate for your web container).

## Installing commons-attributes-plugin

To properly integrate Commons Attributes with Maven (as required by the Attributes Sample), you need to install an additional plugin.

To install the `commons-attributes-plugin`, execute the following commands:

    cd $ACEGI_SECURITY/doc

    maven plugin:download
        -DgroupId=commons-attributes
        -DartifactId=commons-attributes-plugin
        -Dversion=2.1

The second (final) command should be executed on a single line.

## Building All JARs

Sometimes people are already using Acegi Security, and they just want to build the latest code from CVS. To build all artifacts (JARs) and install them into your local Maven repository, simply perform a CVS checkout and install the `commons-attributes-plugin` (as detailed above), and then execute:

    cd $ACEGI_SECURITY/doc

    maven multiproject:install

You can then check your `$HOME/.maven/repository/acegisecurity` directory and it should contain all of the latest Acegi Security JARs.

## Building The Site

By "site" we mean the web site you can browse at http://acegisecurity.sourceforge.net, which includes the reference documentation and all of the Maven reports. If you'd like a local copy, simply execute:

    cd $ACEGI_SECURITY/doc

    maven -Dpassword= changelog:create-cvspass

    maven    multiproject:clean multiproject:site
    	-Dmaven.jar.override=on
    	-Dmaven.jar.clover-ant=1.3.3_01

As per the Maven Changelog Plugin Documentation, you must tell the plugin the "anonymous CVS pserver" password is blank. This is why there is the "create-cvspass" command shown above. You should only need to do this once.

## Memory and Clover Workarounds

If you get an `OutOfMemoryError`, simply execute the following before calling Maven:

    set MAVEN_OPTS=-Xmx1024m

If you get an `[ERROR] Invalid license: Invalid license file [E1202]`, this is because the `maven-clover-plugin` is using an old version of `clover-ant-xxx.jar`. Whilst Acegi Security's `project.properties` specifies a newer version, subprojects have an inheritence problem and don't pick this up (as of the time of writing). To workaround this issue, you need to specify those override properties on the command line. For example, to execute the Clover reports for the core subproject, you would do the following:

    cd $ACEGI_SECURITY/core

    maven clover:html-report -Dmaven.jar.override=on -Dmaven.jar.clover-ant=1.3.3_01

## CVS-over-SSH Workarounds

Another possible problem is related to CVS-over-SSH ("ext" in CVSROOT) appearing to freeze. The following instructions assume you're an Acegi Security developer who has CVS access to the project, as if you're not then you shouldn't be trying to use CVS-over-SSH. The instructions above all relate to goals which use the default, anonymous pserver CVS repository.

If you really need authenticated SSH-based access, first check your `$ACEGI_SECURITY/build.properties` contains a `maven.username` equal to your SourceForge username. If your Maven CVS or SSH commands still don't work, test you have automatic CVS-over-SSH access operational by executing the following command:

    cvs -d :ext:YOUR_SOURCEFORGE_USERNAME@cvs.sourceforge.net:/cvsroot/acegisecurity

If this CVS command executes without requiring any interaction such as password entry, you're ready to proceed. If it fails (or requires a password entry), you probably need to review your CVS setup. This varies depending on your CVS client.

One Windows-based command line CVS-over-SSH-with-auto-login setup that works very well is to install CVSNT (which has a CVS client console utility) and PuTTY (download `putty.zip`) together, and use PuTTY's Pageant to automatically authenticate. A resource that describes in detail how to configure WinCVS (which internally uses CVSNT's command line client) with PuTTY (including automatic SSH authentication) is SourceForge's instructions. One issue with the SourceForge instructions is they forget to mention how to tell the CVS command-line client to use `plink.exe`, which is PuTTY's SSH command-line version. The solution is to execute `set CVS_RSH=C:\Program Files\putty\plink.exe` (or whatever path is appropriate to plink) before running the CVS command line. In fairness, the SourceForge instructions target the Windows front-end to CVS, whilst we need the command-line version to work.

It is worth noting that as the Maven project uses the anonymous pserver repository for most operations, these setup instructions really only apply if doing something like deploying the site over SSH etc.