If you don't already, install Java JDK 1.6. For OSX the package is called
Java for OS X 2012-003 Developer Package, just get the latest one as long as it is
1.6. Now add the path to your
.bash_profile in an environmental variable called
Make sure that Maven (Java's package manager) is installed; if not, go get it here. You'll wan't to add the
M2 environmental variables to your
export M2_HOME="/usr/share/java/maven-3.0.3" export M2=$M2_HOME/bin
You'll alsp want to download Roo, Spring's RAD CLI, this will prepare you to make quick modifications to your Spring application as well as generate new ones. To setup a Spring application on Heroku, read here.
mkdir ~/lib mv ~/Downloads/spring-roo-1.2.2.RELEASE/ ~/lib cd ~/lib/spring-roo-1.2.2.RELEASE ln -s roo.sh roo echo "export PATH=$PATH:~/lib/spring-roo-1.2.2.RELEASE"
And finally make sure you have Postgresg installed. Use pgAdmin III to create a user called
spring-todo with password
spring-todo and a database
spring-todo. Append the bin to your path in your
.bash_profile as well as the
$DATABE_URL which the application will use to connect to the database.
export PATH=$PATH:/Library/PostgreSQL/9.1/bin export DATABASE_URL=postgres://spring-todo:spring-todo@localhost/spring-todo
Running the application
To get the application going, simply instruct Maven to build then Java to run Jetty like so:
mvn build java -jar target/dependency/jetty-runner.jar target/*.war
Now you should be able to get to the application in your browser at http://localhost:8080/
Testing and developing
With Maven, running tests is a breeze. From the root of the project, simply run: