Setting up Dev environment - serenapotts/lifeforachild GitHub Wiki
Setup instructions for the Life for a Child Development Environment.
Software
Download and install:
- Java JDK 6
- Tortoise SVN
- Springsource toolsuite (STS)
- Apache Tomcat 6
- MYSQL Server and MYSQL Workbench
Note: Maven and Roo come installed with STS so don't need to be installed separately.
Maven Setup
- Add the
M2_HOME
environment variable by opening up the system properties (WinKey + Pause), selecting theAdvanced
tab, and theEnvironment Variables
button, then adding theM2_HOME
variable in the user variables with the valueC:\Program Files\Apache Software Foundation\apache-maven-3.0.3
. Be sure to omit any quotation marks around the path even if it contains spaces. Note: For Maven < 2.0.9, also be sure that theM2_HOME
doesn't have a\
as the last character. - In the same dialog, add the
M2
environment variable in the user variables with the value%M2_HOME%\bin
. - In the same dialog, update/create the Path environment variable in the user variables
and prepend the value
%M2%
to add Maven available in the command line. - In the same dialog, make sure that
JAVA_HOME
exists in your user variables or in the system variables and it is set to the location of your JDK, e.g.C:\Program Files\Java\jdk1.5.0_02
and that%JAVA_HOME%\bin
is in your Path environment variable.
Database Setup
Open command prompt and run the following:
> cd C:\Program Files\MySQL\MySQL Server 5.5\bin
mysqld
Open a new command prompt and run the following:
> mysqladmin -u root password NEW_PASSWORD_HERE
> cd C:\Program Files\MySQL\MySQL Server 5.5\bin
> mysql -u root -p
-- enter password created above when requested
mysql-shell> create database life_for_a_child;
mysql-shell> use life_for_a_child;
mysql-shell> CREATE USER 'dev'@'localhost'
mysql-shell> IDENTIFIED BY 'password';
mysql-shell> GRANT ALL PRIVILEGES ON . TO 'dev'@'localhost'
mysql-shell> WITH GRANT OPTION;
mysql-shell> exit;
Check you can connect using this new user: mysql -u dev -p
Code Setup
Checkout code from https://github.com/serenapotts/lifeforachild
- fork it to your own Github repository if need to.
Running the Application
- start STS
- File > Import > Maven > Existing Maven Projects
- Specify checkout directory from above and continue
- Jars will start to download and everything build, this may take some time. Make sure everything builds correctly.
- Window > Show View > Servers
- Right click > add server, select apache, tomcat 6 server, select tomcat dir downloaded previously
- Right click on tomcat server, add and remove, add lifeforachild
- Open persistence.xml, change 'hibernate.hbm2ddl.auto' to create
- Start the tomcat server and make sure it connects ok.
- Stop the server and change the persistence file back (otherwise it will recreate the tables each time and you will lose your data)
Database Data Load
-
Add an environment variable for
MYSQL_HOME
-C:\Program Files\MySQL\MySQL Server 5.5
Add to the path%MYSQL_HOME%\bin
-
Open the command prompt and
cd \lifeforachild\src\main\resources\sql
mysql -u root -p mysql-shell> source all.sql;
This should run a script and finish successfully and you should now see data in the database.
If something goes wrong there is a droptables.sql
script in the same directory to clear the database and start again.
Starting the application
- Start tomcat again
- Go to http://localhost:8080/lifeforachild in IE
- Ask Serena for a login