You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 17 Next »

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 Action 2. For more on how to go to work with the distributed binaries right away, see Getting Started. 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.

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 distribution you can download directly or 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.

Respository (SVN)

Use Subversion to checkout the source code.

> svn co https://svn.apache.org/repos/asf/incubator/webwork2/

Building with Maven

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

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

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

> mvn install

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.

Building with Ant

As and for an alternative, you can also build the framework using Ant and Ivy.

What is Ant

Ant is the defacto standard build tool for Java project. If you don't have Ant installed, it's each to download and setup. As with Maven, you can extract the Ant distribution to the folder of your choice, and then add the bin folder to your system path.

What is Ivy?

If you checked out the sources from the repository, you might have noticed that the lib directory is empty. Unfortunately this does not mean that the framework has no external dependecies. As a full featured MVC framework, it has lots and lots of dependencies. Of course, this means that there has to be some kind of dependency management.

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, which many developers already use.

Skipping dependency resolution

The build now knows the property "skip.ivy". This may be specified from build.properties file or from a command line ant execution with -Dskip.ivy=true. If set, 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 Ant 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 don't have these jars at hand, look in the lib/build directory of your SAF2 module after you called ant init in the step before...
  • Our Clover license is found in the common directory of the struts module. Place the clover-license.jar into your $ANT_HOME/lib directory as well.

Now you are ready to ...

Build It

From the root of your SAF2 project folder

> ant

JDK/JRE Compatibility

  • The framework requires JDK 1.4.2+ to build. JDK 5.0 is not required for building.
  • Action2-based applications require JRE 1.4.2+ to run. JRE 5.0 is not required to run unless your application uses the optional xwork-tiger module, which adds some Java 5.0 specific features to the framework.

Java 5 with Java 1.4 backward compatibility is being considered for SAF 2

  • No labels