|
  • Maven Information
Last Published: 03/07/2008

52n Security Developer Information

This document contains some informations and guidelines for developers and committers.

At the 18.09.2006 we switched from Ant to Maven 2 and also changed the version control system from CVS to subversion.

So there are new challenges to get started with these technologies.

Maven 2

Maven 2 is a bit more than only a build tool, e.g. as you can see here, a project website generation is also provided.

The best way to start and get an introduction is at the maven project site .

The book Better Builds with Maven is free avaiable and gives a very good explanation of what you can do with maven.

For our project we use the standard directory layout.

Every module will use the following directory structure.

        /                            // module root
        |-- pom.xml                  // the module project descriptor
        |-- src
        |    |-- main
        |    |   |-- java            // java files (non test java files)
        |    |   |
        |    |   |-- resources       // resource files, wich should be copied to the classes output directory
        |    |   |
        |    |   `-- filters         // filter files, most *.properties files for filtering the resource files
        |    |
        |    |-- test
        |    |   |-- java            // test java files
        |    |   |-- resources       // test resource files
        |    |   `-- filters         // test filter files
        |    |
        |    `-- site                // all files relate to the website.
        |
        `-- target                   // the output directory, containing all build results

The 52n-security project by self is the parent project of the modules and has also a pom.xml. So the whole project layout is quite simple and looks like the following.

    52n-security
        |
        |-- modules...  // e.g. 52n-security-core with a directory layout descibed above.
        |-- src         // there are only site source files, no more.
        |     `--site   // the files for this site
        |
        `-- pom.xml     // the main project descriptor,
                        // containing all settings wich are common for all modules

If you start a maven lifecycle phase in the project root directory, it will execute the phase for every module. Doing so you can build all artifacts with one statement.

This should be enough to get started with maven, please refer to maven website to get more information.

The 52n-security Project Descriptor

There are only two importent things to know about the 52n-security pom.xml.

common libraries

The first is that it defines some common libraries wich are used by the modules.

commons-logging 1.0.4
as the common logging library, all logging statements should use these library.
log4j 1.2.8
this is the old logging library and currently also used in code, but the aim ist to change the scope of this lib to "test" and remove the dependencies in the source.
junit 3.8.1
JUnit is the main test library and the modules don't need to redeclare this library.
common profiles

The second is a profile, wich is used to redeclare the filter file location.

The id of the profile is env-dev, because it is activated if the property env with value dev is given.

The intension of the profile is to declare a common location of the filters file in the development environment.

The normal filters are the

src/main/filters/config.properties

and

src/test/filters/test.properties

files.

But if this profile is activated the filters are

$user.home /local_config.properties

and

$user.home /local_test.properties .

Doing so should it make easier for developers to maintain there personal preferences.

The profile XML
    <profile>
        <!-- Developement Environment -->
        <id>env-dev</id>
        <activation>
            <property>
                <name>env</name>
                <value>dev</value>
            </property>
        </activation>
        <properties>
            <!-- testfilter file is named 'local_test.properties' -->
            <profile.testfilter.name>local_test</profile.testfilter.name>
            <!-- filter file is named 'local_config.properties' -->
            <profile.filter.name>local_config</profile.filter.name>
            <!-- the filters path for developers is the user home
                 this make it easy to have one configuration file for
                 all projects, if the designer of the pom is carefully with
                 properties -->
            <profile.filter.path>${user.home}/</profile.filter.path>
            <profile.testfilter.path>${user.home}/</profile.testfilter.path>
        </properties>
    </profile>

Subversion

We recommend to read the book Version Control with Subversion because there are some changes in relation to the former CVS System.

On this place we only mention that subversion uses revision numbers for the whole repository and not for single files. It also makes use of atomic commits, wich means that if you checkin changes on different files in one commit, the revision increase only one times and you can revert all changes in going back to the last revision.

In the former CVS Repository were many commits done without a comment. This was not the best way to get an overview of the history of the source code.

So hence we want to etablish the best practice to comment every commit. Because doing so helps extrem to understand what and why changes take place.

back top