Building Instructions
=========================

You can build Project Wonder with Ant, Maven and Eclipse.

For information on getting started with Project Wonder, go to:

    http://en.wikibooks.org/wiki/Programming:WebObjects/Project_WONDER/Quickstart

Building with Ant:
=========================

Ant should be found in /Developer/Java/Ant/bin

0. Prerequisites:

   ant 1.7: execute 'ant --version' to confirm that ant is properly installed
            and that it is at version 1.7 or later.

1. Open a terminal and cd into the Wonder root directory.

2. A servlet.jar file needs to be available for some parts of Wonder. On Mac OS X, the
   servlet.jar file should be located under the /Developer/Java/J2EE directory. The
   servlet.jar file can be placed in the /Library/WebObjects/Extensions directory,
   or its equivalent on a Windows system.

3. A wobuild.properties file should be placed in, on Mac OS X, the ~/Library directory.
   On Windows, this should go into a Library folder in the directory pointed to
   by the 'user.home' Java system property. Usually, this may be at
   C:\Documents and Settings\<user name>\Library.

   An example of this file is:

   ==== START wobuild.properties ====

   wo.woroot=/
   wo.wosystemroot=/System
   wo.wolocalroot=/

   ==== END wobuild.properties ====

   These may, or may not, be necessary for some functionality:

   ==== START wobuild.properties, perhaps  ====

   wo.dir.root=/
   wo.dir.user.home.library.frameworks=/User/yourname/Library/Frameworks
   wo.dir.local=/
   wo.dir.library=/System/Library
   wo.dir.user.home.library=/User/yourname/Library
   wo.dir.local.library=/Library
   wo.dir.library.frameworks=/System/Library/Frameworks
   wo.dir.local.library.frameworks=/Library/Frameworks
   wo.dir.system=/System

   ==== END wobuild.properties, perhaps  ====

4. Invoke ant -projecthelp, but normally you would do for WO 5.3:

  ant frameworks; sudo ant frameworks.install
  ant applications; sudo ant applications.install
  ant examples; sudo ant examples.install

and for WO 5.4.x

  ant -Dwonder.patch=54 frameworks; sudo ant -Dwonder.patch=54 frameworks.install
  ant -Dwonder.patch=54 applications; sudo ant -Dwonder.patch=54 applications.install
  ant -Dwonder.patch=54 examples; sudo ant -Dwonder.patch=54 examples.install

If you have write privileges in /Library/Frameworks, /Library/WebObjects/JavaApplications, and
/Library/WebServer/Documents/WebObjects/Frameworks, you may do without the "sudo".

Building with Maven:
=========================

Steps 1 and 2 are required only once or when you clean your local Maven repository (rm -Rf ~/.m2/repository).

1. Download and Install Maven (http://maven.apache.org)

2. Import the WebObjects frameworks as jars into the local repository:

  mvn wobootstrap:install

See http://wiki.objectstyle.org/confluence/display/WOL/Quick+Start for the settings.xml
needed to make this work.

3. Open a terminal and cd into the Wonder root directory.

4.a. Build Wonder compatible with WO 5.3:

  mvn clean install -P wo53

4.b Build Wonder compatible with WO 5.4:

  mvn clean install -P wo54

NOTE: Sometimes the Maven version range mechanism doesn't work as expected and
you can experience the following problem:

   [INFO] Failed to resolve artifact.

   No versions are present in the repository for the artifact with a range [5.4,5.5)
     com.webobjects:JavaFoundation:jar:null

This problem usually occurs when your ~/.m2/settings.xml is missing the repository definition
relevant for where you've previously deployed/retrieved the webobjects jars. It can also be
caused by some wrong Maven metadata in your local repository.

To avoid this problem, you can force the WebObjects version using the 'woversion' property, i.e.:

  mvn clean install -P wo53 -Dwoversion=5.3.3

  or

  mvn clean install -P wo54 -Dwoversion=5.4.3

NOTE: Make sure you have your settings.xml properly configured.
See the step 2 of Maven Quick Start Tutorial for more information:

	http://wiki.objectstyle.org/confluence/display/WOL/Quick+Start

Deploying Releases with Maven:
==============================

It's naturally highly beneficial to build your own products against a fixed version / release of Wonder
rather than a snapshot. The following script can automate these steps:
- svn revert
- svn up
- substituting the pom's version with the svn version (e.g., 5.0.0-SNAPSHOT becomes 5.0.0.1234),
- mvn clean [package | install | deploy ] with relevant properties / profile
- clean
- svn revert

  See:
  ant -f Build/build/maven.release.xml help

Building with Eclipse:
=========================

1. Install Eclipse http://www.eclipse.org

2. Install WOLips

3. Open the projects you need, choose "WOLips>Install..." in the context menu

