Skip to content

Building from source

cbeams edited this page Dec 20, 2011 · 6 revisions

Introduction

The Spring Framework is built using a combination of Ant and Ivy called Spring Build[1].

The steps to build the framework using the current build system have been documented at the SpringSource blog here. These steps are still accurate with the exception of checking out the source, as the framework has since moved from Subversion to Git/GitHub.

Check out the sources

If you haven't already, you'll need to set up Git on your local machine[2]. See the instructions for Windows, Mac and Linux.

Clone the repository

$ git clone git://github.com/SpringSource/spring-framework.git

Or, fork and clone the repository

As a variation on the above, you may wish to create your own fork of the spring-framework repository. This will give you full control, allow you to submit pull requests back into the main repository and generally enjoy all the benefits that distributed version control has to offer.

Once you've created your own fork, then you can clone from it directly:

$ git clone [email protected]:<my_username>/spring-framework.git

Remaining steps

Once you have a local repository, you can continue with steps 2-6 as documented in the blog post mentioned above. These steps are geared toward Eclipse users, and demonstrate how to get up and running in an IDE with Spring. If you're more impatient, and just want the command-line instructions, here they are...

Set up Ant

Make sure you've got a recent version of Ant (1.8.2 or better is a safe bet), and configure ANT_OPTS to ensure that the VM doesn't run out of memory during the build:

$ ant -version
Apache Ant(TM) version 1.8.2 compiled on October 14 2011

$ export ANT_OPTS='-XX:MaxPermSize=1024m -Xmx1024m'

To build and run all tests

$ ant -f build-spring-framework/build.xml test

The first time you run this, it'll take quite a while, as all of Spring's dependencies (even the optional ones) need to be downloaded into your local ivy-cache directory. After this initial downloading is complete, you can expect a complete build/test run to take anywhere between 5 and 20 minutes depending on your system.

To install spring artifacts into your local Maven cache

$ ant -f build-spring-framework/build.xml jar install-maven-central

[1] With the completion of SPR-8116, Spring's build system will be ported to Gradle. Put a watch on that issue, or stay tuned to @springframework and the SpringSource team blog to be notified when this migration is complete.

[2] Actually, it is still possible to check out the repository using Subversion, thanks to GitHub's dedicated support for Subversion clients:

svn checkout https://github.com/SpringSource/spring-framework

(but even so, we recommend you give it a shot the Git way; you'll be glad you did)

Clone this wiki locally