Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Why Build?

Most developers will never need to build the framework from source. The distribution package contains everything a developer needs to get started and become productive with the framework. For more on how to go to work with the distributed binaries right away, see Ready, Set, Go!. However, there are situations when someone will want to build the framework from scratch. You may want to try out new tweaks and patches, or you might want to try writing your own tweak or patch.

Info

If you just want to use the latest development build, perhaps because a patch you need has been applied, you can also download a nightly build.

Getting the Sources

The source code for the framework is available as a distribution you can download directly and from the source code repository.

Distribution

The distributions of the framework contain all sources, as well as all needed libraries for building JARs and running. Distributions can be downloaded from the Apache Struts project.

Repository (SVN)

Use Subversion to checkout the source code.

Code Block
> cd C:\projects\Apache\
> git clone https://git-wip-us.apache.org/repos/asf/struts.git

Building with Maven

The default build environment is Maven. To get started with Maven

  • Download Maven 3
  • Extract Maven 3 to a directory of your choice
    • (e.g. \opt\Apache\Maven\maven-3.3.3)
  • Add the bin folder under that directory to your system path
    • (e.g. PATH=%PATH%;C:\opt\Apache\Maven\maven-3.3.3)

Change to your framework home directory (e.g. C:\projects\Apache\struts) and run

Code Block
> cd C:\projects\Apache\struts\
> mvn clean install -Pall

That will take care of the basic maven build. There is a bunch more that you can do. Checkout out Building with Maven for more information.

NOTE: The above assumes that the Struts build depends on a version of XWork which is available from a Maven repository. If this is not the case (e.g. when Struts depends on an unreleased XWork snapshot), you will need to build XWork yourself, and install it into your local Maven repository, before attempting to build Struts itself. See Building with Maven for instructions on building XWork.

JDK/JRE Compatibility

  • The framework requires JDK 1.7 to build.

Next: Building with Maven

Getting the Sources

Distribution

The current distribution packages of webwork contain all sources, as well as all needed libraries for building jars and running. Distribution packages are found here.
The dependency resolution via Ivy is disabled by default for build from distribution package (> Webwork 2.2 Beta 4). If you need to work with the Clover and Ivy related buildfile tasks, you might want to follow the instructions below.

CVS

The sources are are hosted via CVS on java.net. So getting your sources is quite standard:

  1. If you have not already done, login to repository:
    cvs -d :pserver:guest@cvs.dev.java.net:/cvs login
  2. Checkout the the webwork sourcetree:
    cvs -d :pserver:guest@cvs.dev.java.net:/cvs checkout webwork
  3. Checkout the the opensymphony common sourcetree:
    cvs -d :pserver:guest@cvs.dev.java.net:/cvs checkout opensymphony/common

If you are a registered user at Java.net, you might use your username instead of anonymous guest account.
For detailed information on how to setup different clients, visit https://webwork.dev.java.net/servlets/ProjectSource.

Building

We assume that you are familiar with ant as the standard build tool in the Java world.

What is Ivy?

If you checked out the sources from CVS, you might have noticed that the lib directory is empty. Unfortunately this does not mean that webwork has no external dependecies at all. To be honest, as a full featured MVC framework it has lots of dependencies, which in turn means that there has to be some dependency management. This is where Ivy comes to play.
Ivy is a free java based dependency manager, with powerful features such as transitive dependencies, maven repository compatibility, continuous integration, html reports and many more. Ivy is fully integrated with ant, so you do not have to get into a complicated tool. See http://jayasoft.org/ivy for details.

Installing and using Ivy

The installation is quite trivial: Put a copy of the ivy-1.x.jar found in the common directory of the opensymphony module in your $ANT_HOME/lib directory.
If you want to test the Ivy functionality, ensure you have an internet connection. Change into the webwork module directory and execute ant init (as you might guess, any other task depends on init). Ivy will now resolv all dependencies and (hopefully) download all required jars and put it into the lib directory.
See Dependencies for informations on how to integrate Ivy in your own Webwork2 based projects.

Note
titleSkipping dependency resolution (> Webwork 2.2 Beta 4)

Build now knows the property "skip.ivy". May be specified from build.properties file or from commandline ant execution with -Dskip.ivy=true. If set to true, dependency resolution via Ivy is omitted and build is done with current jars found in lib directory.
This behaviour is turned on by default for builds from the distribution package.

JUnit and Clover

The full build process will require JUnit and Clover.
Place a copy of junit.jar (>= 3.8.1) and clover.jar (>= 1.3.9) into your $ANT_HOME/lib directory (if not already exists). If you haven't got these jars at hand, look into the lib/build directory of your webwork module after you called ant init in the step before...
Opensymphony Clover license is found in the common directory of the opensymphony module. Place the clover-license.jar into your $ANT_HOME/lib directory as well. Now you are ready to ...

Build

Call ant jar or simply ant to build the webwork jars. Play around with other targets, as you like.

JDK/JRE Compatibility

...