Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

First, let's review some Maven basics. Maven uses the notion of a build lifecycle life-cycle to which plugins can attach. ( Plugins are similar to Ant tasks. ) When a Maven build is invoked, we specify a point in the lifecycle life-cycle up to which the build should proceed. The compile phase compile comes before test, and test comes before package, and package comes before install. Once we have Maven setup, we can invoke the Struts build, and specify which phase the build should use.

...

The install phase builds up the project ("package"), and installs any JARs it needs into your local repository (e.g. ~/.m2/repository). Once installed, the JARs can be used by any other Maven project you build.  The install phase is the default phase if none is specified.

...

That's it! Maven will download all any dependencies the build needs, ; run all unit tests, ; package up the JARs, and ; then install the new JARs locally. For your convenience, copies of the JARs can be found in the target directories of each module. For example, after the build, the main JAR can found at core/target/struts2-core-2.0-SNAPSHOT.jar.

Warning
titleIt's suppose supposed to be automatic, but you might still have to press the button

Sometimes, licensing restrictions prevent Maven for from downloading all the JARs that a build might need. For example, JavaMail and Activation, can only be downloaded from Sun. When this happens, Maven will display a helpful message that explains how to install these JARs manually. After downloading the required JAR, follow the instructions to install it to the your local repository. Once installed, the JAR is availale available to all your Maven builds, not just Struts.

...

There are other phases that can be useful when working with Maven. The package phase will just JAR (or WAR) the modules. The test phase will run only the execute unit-tests. The compile phase will only build the source-code (but not the test sources). And the clean phase will remove all artifacts, typically the entire target directory.

Build profiles

The next step to in building the framework with Maven is to understand build profiles. Profiles provide different configurations for a build. There are several profiles, including default, xwork, and _thirdparty".

Profile

Description

default

Builds site, api, and core

apps

Builds the example applications

plugins

Builds all plugins

extras

Includes the extras module that cannot be part of the default build due to licensing incompatibilties incompatibilities

xwork

Includes the xwork build

Tbe The default profile will work for most developers, but ; however some developers will want to use additional profiles as because they work on both XWork and other modules, such as the JasperReports integration.

Specify Specifying a profile is as simple aseasy:

Code Block
titleProfile, please
> mvn -Pprofile ...

...

If you want to build all the extras Extras module (not included with in the default build, ) use the _extras*_profile.

...

In the second run, the Extras module is built. If you decide to make use of this module, be sure to review the licenses of its dependencies, since they may be fall under a license that is incompatible with the Apache License.

...

Struts 2 is an extension of the XWork framework. While Struts2 adds a lot of value for web developers, much of the core functionality derives is derived from XWork. The xwork plugins add the capability to build against a current XWork checkoutcheck-out, rather than a precompiled pre-compiled JAR.

The plugin assumes that the latest XWork code is checked out and is located at ../xwork, relative to the struts2 folder. You can check out XWork using the Subversion command:

...