| <document> |
| <properties> |
| <title>How to build</title> |
| </properties> |
| <body> |
| <section name="Obtaining the code"> |
| <p> |
| You can obtain the code by downloading the <a class="externalLink" href="http://synapse.apache.org/download/2.0.0/download.cgi">source distribution</a> or, more commonly, checking out the source from Subversion (SVN). |
| To checkout the code from <a class="externalLink" href="http://subversion.tigris.org/">Subversion</a>, firstly get subversion installed, then use the following commands: |
| <pre>svn co http://svn.apache.org/repos/asf/synapse/trunk/java [path-where-you-want-the-code]</pre> |
| If you are a committer then you need to use the secure version: |
| <pre>svn co https://svn.apache.org/repos/asf/synapse/trunk/java [path-where-you-want-the-code]</pre></p> |
| </section> |
| <section name="Building"> |
| <p> |
| The first thing you need to build the code is JDK1.5 or JDK1.6 and <a class="externalLink" href="http://maven.apache.org/download.html">Maven2</a>. Preferred version for building the code is the version 2.1.0 of Maven2. |
| </p> |
| <p> |
| To build, in the top level Synapse folder do: |
| <pre> |
| mvn clean install |
| </pre> |
| This will build the distribution under the modules/distribution/target directory. How ever to build the site you need to execute the command: |
| <pre> |
| mvn site:site |
| </pre> which will build the complete synapse site including the API documentation in the target/site directory</p> |
| </section> |
| <section name="Offline builds"> |
| <p> |
| The first time you build Maven downloads all the required dependency jars to your local repository, |
| after there has been a successful build you can add the "-o" parameter to the above commands to run in offline mode |
| which avoids going out to remote Maven repositories. The result - the build runs faster. |
| <pre> |
| mvn clean install -o |
| </pre> |
| </p> |
| </section> |
| <section name="Skipping tests"> |
| <p> |
| If you don't want to have all the Synapse test cases run during the build you can add the parameter "-Dmaven.test.skip=true", eg: |
| <pre> |
| mvn clean install -o -Dmaven.test.skip=true |
| </pre> |
| </p> |
| </section> |
| <section name="Updating Snapshots"> |
| <p> |
| Sometimes the trunk build uses snapshot versions of some dependency jars which can go out |
| of date but may not get refreshed in your local Maven repository even when the "-o" parameter is not used. |
| So if you get build failures you can try refreshing any snapshot dependencys with the "-U" parameter, eg: |
| <pre> |
| mvn clean install -U |
| </pre> |
| By default the Maven local repository is in your home directory, you can change this so the build |
| uses use a different local repository with the parameter "-Dmaven.repo.local=", eg: |
| <pre> |
| mvn clean install -Dmaven.repo.local=\Synapse\MyRepo |
| </pre></p> |
| </section> |
| <section name="Eclipse/IDEA Projects"> |
| <p> |
| You can create Eclipse/IDEA project definitions for Synapse (that can be imported directly into Eclipse or open with IDEA). |
| At the top level Synapse folder run: |
| <pre> |
| mvn eclipse:eclipse |
| </pre>or |
| <pre> |
| mvn idea:idea |
| </pre> |
| Now within eclipse you can import those Synapse projects into an Eclipse workspace. |
| From Eclipse do File -> Import, expand the "General" toggle and choose "Existing Projects into Workspace", |
| click Next, click Browse and navigate to your Synapse SVN folder, click OK and it should find the six Synapse projects, |
| click Finish. That should set up the projects and show them in the Package Explorer. |
| There will be lots of compile errors about missing classpath entries, |
| to fix this select Window -> Preferences, expend the Java toggle, then expand the Build Path toggle and |
| select Classpath Variables. |
| Click New and use the name "M2_REPO" and then click Folder and navigate to you local Maven repository |
| (eg C:/Documents and Settings/Administrator/.m2/repository), click OK and again OK and it should rebuild everything with all the compile errors gone. |
| </p> |
| </section> |
| </body> |
| </document> |