Source Code Guide
The Struts Scripting component, for the most part, follows Apache Struts build and source code layout, so if you are familiar with another Struts component, you'll be at home here. If not, this guide first walks you though what is where and why. Next, it gives help on how to build common artifacts.
Again, since the heavy lifting is done by the Bean Scripting Framework and the scripting engines themselves, there isn't much code to this project itself.
Source code layout
When you unzip the latest release of Struts or check it out from Subversion (more help on Subversion at the Struts source code), you'll be confronted with a directory structure that includes:
/apps/scripting-mailreader
- A modified version of the classic Struts Mailreader example application. This rendition replaces Java-coded Struts Actions with Groovy scripts./scripting/src
- All other scripting source code can be found here/scripting/src/main/java
- The source code for the Struts Scripting framework itself
/scripting/src/site/xdocs
- The XML source code for all documentation, including this guide./scripting/target
- Maven puts all compiled files into this temporary directory.
Next, we'll look at how to build both Struts Scripting library and the Mailreader example application.
Build Instructions
Struts Scripting uses Apache Maven 2 to build its JAR, example application, documentation, and distribution files. Maven is used throughout Struts for building subprojects, providing a consistent build environment to Struts users. To follow these build instructions, you will need to have Apache Maven 2 installed and its mvn
executable available in your command path.
Since there are a bunch of build targets, we will break the build down into tasks that you might want to accomplish and show the best way to complete them.
- Build the Struts Scripting JAR - Run '
mvn jar:jar
' which will create the JAR as/scripting/target/struts-scripting-VERSION.jar
. - Build the Mailreader example - Change to
/apps/scripting-mailreader
and run 'mvn install
' to create/apps/scripting-mailreadertarget/scripting-mailreader.war
. - Build the documentation - Run '
mvn site
' to create the Struts Scripting website at/scripting/target/docs
.