Struts Action Framework and Maven 2

Maven Setup

Download and install Maven 2 from

Maven 2 does not use .properties files. Per-developer and per-system configuration is done in ~/.m2/settings.xml. (Where '~' represents the user's home directory.) For more information, refer to the settings model and the Suggested Settings section below.

Acquiring the Source Code

Checkout Source from Subversion

The Struts Subversion repository is organized into sub-projects. You can check out Struts Action 1 alone using this URL:

   svn co struts1

Or you can check out all of the sub-projects, including the sandbox, with this:

   svn co current

Snapshot or Distribution

The following instructions should work equally well from the 'src' directory of a Struts snapshot or distribution. If they don't, let us know!

Building with Maven

Local Install

To build and install the framework artifacts (pom and jar files) in your local Maven repository:

   $ mvn

(The default goal, configured in struts1/pom.xml is install.)

To clean up, which will delete all of the 'target' directories:

   $ mvn clean

To build the example apps:

   $ mvn -P apps
   $ cd apps
   $ mvn

Binary and Source Assembly

To build the assemblies, enable the 'pre-assembly' profile (which produces the javadoc and source artifacts) as well as 'itest' and 'apps', and execute both 'install' and 'site':

   $ mvn install site -P apps,itest,pre-assembly

And then create the assembly:

   $ mvn assembly:assembly

The output will be in 'assembly/target/assembly/out'.

NOTE: The 'assembly:assembly' goal must be run from struts1/assembly.

In this post, John Casey explains why 'mvn assembly:assembly' is a separate command with Maven 2.0.

Integration Testing

The Maven 2 build lifecycle includes a phase for integration testing. See MNG-1381 and the Testing Strategies wiki page for more information.

Integration tests for Struts 1 are located under the integration module. Integration tests will only be run if the itest profile is enabled.


The integration/apps-it module contains tests to confirm that each example app starts and displays its default page:

   mvn -P itest

In addition, each module inherits Cargo plugin configuration (from apps/pom.xml) which will start Tomcat 5.x and deploy the app:

    mvn package cargo:start

Then visit http://localhost:8080/webappname in your browser. This requires that the cargo.tomcat5x.home system property is set, usually either on the command line (-Dcargo.tomcat5x.home=...) or in ~/.m2/settings.xml. See the Suggested Settings section, below.

Cactus Tests

The Cactus tests for Struts Taglib are not working and have been moved to the sandbox/apps-test/taglib-it module.

Suggested Settings


<settings xmlns=""
    <!-- Uncomment this when the 'central' repo on ibiblio is down 
         See: -->
    <!-- mirrors>
    </mirrors -->

       <!-- ** CYGWIN USERS ** SEE NOTE BELOW -->




Note for Cygwin Users

Even though you execute mvn within the cygwin shell, Maven's deployer plugin looks under %HOMEPATH% for the known_hosts file. If it's not found, you'll be prompted to continue.

...blah blah
...blah bhah
Using private key: C:\cygwin\home\myname\.ssh\id_dsa
The authenticity of host '' can't be established.
DSA key fingerprint is 79:7c:cb:6a:44:47:b2:ef:5c:66:28:d7:40:0d:b1:f9.
Are you sure you want to continue connecting? (yes/no): yes

So, unless you don't mind being interrupted at each project and module secure copy, just to type 'yes', you'll have to use this work-around.

$mkdir /cygdrive/c/Docu<hit tab to complete>/username/.ssh

$cp /home/username/.ssh/known_hosts /cygdrive/c/Docu<hit tab to complete>/username/.ssh/


To deploy snapshots of all framework artifacts (pom and jar, including -sources and -javadoc):

   mvn deploy -P pre-assembly

Maven will choose the appropriate repository from <distributionManagement> based on the version number. (The <snapshotRepository>, if the version number ends in -SNAPSHOT, the <repository>, otherwise.)

To avoid repeated password prompts, configure the apache.snapshots <server> in ~/.m2/settings.xml.




StrutsMaintenanceMaven (last edited 2009-09-20 23:12:37 by localhost)