How to setup local development environment
Getting source code
Our source code resides in SVN repository. There is a read-only account: anonymous. To checkout the code issue the following command:
svn checkout https://sourcekibitzer.virtual.vps-host.net/svn/sourcekibitzer/dev/sourcekibitzer/trunk/
Obtaining proprietary libraries
At the moment SourceKibitzer depends on 2 proprietary libraries. These are used to access the data warehouse containing measurements of OSS projects. But, don't worry, all needed libraries will be automatically downloaded by the maven from our maven repository.
- com.goingsoftware.detective:detective-api contains declarations of data warehouse interface methods. Without this library you won't be able to compile the source code.
- The second library contains dumb implementations of these interfaces and this library is distributed as a part of SourceKibitzer. You may modify this implementation in order to suit your needs. At the moment dump implementation returns only null-s (TODO return some minimal meaningful data from the dumb implementation).
Maven and profiles
We use maven2 in order to build, distribute and release SourceKibitzer. To maintain various configurations for various environments we use so-called profiles. The source code distribution contains only one profile - local. This should be enough to build and run SourceKibitzer locally (You don't need to create a profile anymore).
Building SourceKibitzer
If you want to build the application then you will need to issue the following command in root directory of the checked out project:
.../trunk> mvn install -Dmaven.test.skip=true -Penv-local
Creating Eclipse project
You should start with creating Eclipse workspace and then adding reference to the maven repository.
And then navigate to trunk/modules/sk-portal directory and generate Eclipse project files using
.../sk-portal> mvn eclipse:eclipse -Penv-local
If you would like also to
- download sources for dependencies then append -DdownloadSources=true
- generate information needed to use Eclipse WTP (version 1.5) then append -Dwtpversion=1.5
Database connection
In order to run the SourceKibitzer locally you will need a database. We use PostgreSQL. After you install it you will need to create a database and a user. We suggest to put the following names:
- database: kibitzer
- user: kibitzer
- password: sk (totally insecure, but shouldn't matter here)
This way you won't need to modify the setting in the local profile. If you are absolutely sure that you want to use other credentials or database name, then either
- navigate to modules/sk-portal/src/main/resources/env/local and modify corresponding settings (kibitzerdb.username, kibitzerdb.password and/or kibitzerdb.url=jdbc:postgresql://localhost:5432/kibitzer)
or
- supply overriding values as system parameters while starting the application. For instance to change the username you should add the following system parameter: -Dkibitzerdb.username=myUsername
To create both database and user, please login to the database console as root and issue following commands:
CREATE USER "kibitzer" WITH PASSWORD 'sk';
CREATE DATABASE "kibitzer" WITH OWNER = "kibitzer" ENCODING = 'UTF8';
At the moment database schema is created using the DDL scripts (TODO update annotations to use Hibernate for that). The scripts are located in modules/sk-portal/src/main/sql/3.2-schema.sql and modules/sk-portal/src/main/sql/3.*-alter-schema.sql. In order to import it issue the following command:
psql -U kibitzer -d kibitzer -h localhost < modules/sk-portal/src/main/sql/3.2-schema.sql
and for each alter schema script
psql -U kibitzer -d kibitzer -h localhost < modules/sk-portal/src/main/sql/3.*-alter-schema.sql
Test Date
The script to populate your database with initial data is located modules/sk-portal/src/test/sql/test-data.sql.
Running project
There are 2 ways to run a project from the Eclipse (for instance, using Eclipse WTP) or using maven. Probably, it is easier to start with maven:
- Run mvn jetty:run -Penv-local from trunk/modules/sk-portal
Tapestry development
In development environment it makes sense to set -Dorg.apache.tapestry.disable-caching=true system variable. This way Tapestry will not cache HTML templates and hence one may modify them while app.server is running
