Building Jetspeed 2.2 from Source with Maven-2

The first step in using Maven2

The first step in using the Maven2 build is to either:

  • copy the settings.xml.sample to ~/.m2/settings.xml
  • --or--
  • encorporate the settings in this file into your existing Maven2 configuration.

Properties Customization

Once in place, please customize the properties as one would have done for Maven1 using build.properties. The properties are preconfigured for embedded Derby, so more changes are required if another database solution is to be used. To complete this step, ensure that the proper jetspeed database active profile is uncommented for your database in the <activeProfiles> element jetspeed-db-drivers-path should be selected for all non-embedded databases. This setting is needed to execute Jetspeed component tests.

Repository Relocation

While the default location of the settings.xml file should not be changed, (e.g. ~/.m2/settings.xml), one can relocate the repository using the <localRepository> element in the settings.xml file. See the settings.xml.sample file for an example. Note that the repository path must be an absolute path and not contain any property expressions.

Checking out the Project

Check out the trunk of Jetspeed-2.2 from

Overview of current Jetspeed2.2 Maven2 commands

Here is a quick summary of the current Jetspeed2.2 Maven2 build commands, (most of these commands can be executed at the root of the J2.2 source tree or at lower levels to perform partial builds/deployments):

commands

explanation

mvn

performs base build and installs J2 artifacts in the Maven2 repository, (install is the default Maven2 goal for this build)

mvn install -P init

performs base build and includes execution of test cases

mvn jetspeed-db:init -P test -db

performs base build and includes execution of test cases,If you want to run the tests, first a test database needs to be (re)created(includes test database setup)

mvn -Dmaven.test.skip=false test

to run test from any directory of the project, maven.test.skip property when set to 'true': skips the compiling tests,when set to 'false': compiles the tests

mvn jetspeed-deploy:deploy -P demo

deploys the war to the server

mvn clean

cleans all build target directories

other commands

explanation

Please note that the Maven2 repositories used by default with this build are generally saturated and the Jetspeed2 Maven2 repository does not yet contain a full mirror of the artifacts required to build Jetspeed2. If you experience download or connection failures, simply restart the build by issuing your last command again to retry.

Additional Notes

  • mvn -P test and mvn -Dmaven.test.skip=false are equivalent.
  • mvn -P test -Dtest=MyTest will execute a single test or matching tests if Ant wildcards are used.
  • Due to forking bugs in the Surefire Maven2 test runner plugin, test output, (e.g. System.out.println()), is not echoed to the build shell. If you wish to see console output for component tests, temporarily comment out the <forkMode> elements in the components/pom.xml and the components pom.xml and run single tests. Note: the forking is required to run multiple tests.
  • The -o offline option can be specified with the commands documented here to force Maven2 to use only the local repository. This can be invaluable in the event the main Maven2 repositories are down and the build insists upon validating a missing or troublesome POM.