Hacking

This is a guide about how to start hacking on LibrePlan project. If you want more information about LibrePlan development you should visit the wiki available at: http://wiki.libreplan.org/.

Contents

Compilation requirements

LibrePlan compilation

Debian/Ubuntu

  • Install requirements:

    # apt-get install git-core maven2 openjdk-6-jdk postgresql postgresql-client python-docutils make gettext cutycapt
    
  • Connect to database:

    # su postgres -c psql
    
  • Use SQL sentences:

    CREATE DATABASE libreplandev;
    CREATE DATABASE libreplandevtest;
    CREATE USER libreplan WITH PASSWORD 'libreplan';
    GRANT ALL PRIVILEGES ON DATABASE libreplandev TO libreplan;
    GRANT ALL PRIVILEGES ON DATABASE libreplandevtest TO libreplan;
    
  • Download source code:

    $ git clone git://github.com/Igalia/libreplan.git
    
  • Compile project:

    $ cd libreplan/
    $ mvn clean install
    
  • Launch application:

    $ cd libreplan-webapp/
    $ mvn jetty:run
    
  • Go to http://localhost:8080/libreplan-webapp/

Fedora

  • Install requirements:

    # yum install git maven java-1.7.0-openjdk-devel postgresql postgresql-server python-docutils make gettext gnu-free-fonts-compat
    

Warning

Use the following command in Fedora 16 or below:

# yum install git maven java-1.6.0-openjdk postgresql postgresql-server python-docutils make gettext gnu-free-fonts-compat
  • Start database service:

    # su - postgres -c "PGDATA=/var/lib/pgsql/data initdb"
    # systemctl start postgresql.service
    

Warning

Use the following commands in Fedora 16 or below:

# service postgresql initdb
# service postgresql start
  • Connect to database:

    # su postgres -c psql
    
  • Use SQL sentences:

    CREATE DATABASE libreplandev;
    CREATE DATABASE libreplandevtest;
    CREATE USER libreplan WITH PASSWORD 'libreplan';
    GRANT ALL PRIVILEGES ON DATABASE libreplandev TO libreplan;
    GRANT ALL PRIVILEGES ON DATABASE libreplandevtest TO libreplan;
    
  • Set postgres user password:

    ALTER USER postgres WITH PASSWORD 'postgres';
    

Warning

These steps are only for Fedora 16 and below:

  • Edit /var/lib/pgsql/data/pg_hba.conf and replace ident by md5

  • Reload database configuration:

    # service postgresql reload
    
  • Download source code:

    $ git clone git://github.com/Igalia/libreplan.git
    
  • Compile project:

    $ cd libreplan/
    $ mvn clean install
    
  • Launch application:

    $ cd libreplan-webapp/
    $ mvn jetty:run
    
  • Go to http://localhost:8080/libreplan-webapp/

openSUSE

  • Install requirements:

    # zypper install git-core java-1_6_0-openjdk-devel postgresql-server postgresql docutils make gettext-tools
    
  • Install Maven:

    # cd /opt/
    # wget http://www.apache.org/dist//maven/binaries/apache-maven-2.2.1-bin.tar.gz
    # tar -xzvf apache-maven-2.2.1-bin.tar.gz
    

    Edit /etc/bash.bashrc.local and add the following lines:

    export M2_HOME=/opt/apache-maven-2.2.1
    export M2=$M2_HOME/bin
    export PATH=$M2:$PATH
    
  • Start database service:

    # /etc/init.d/postgresql start
    
  • Connect to database:

    # su postgres -c psql
    
  • Use SQL sentences:

    CREATE DATABASE libreplandev;
    CREATE DATABASE libreplandevtest;
    CREATE USER libreplan WITH PASSWORD 'libreplan';
    GRANT ALL PRIVILEGES ON DATABASE libreplandev TO libreplan;
    GRANT ALL PRIVILEGES ON DATABASE libreplandevtest TO libreplan;
    
  • Set postgres user password:

    ALTER USER postgres WITH PASSWORD 'postgres';
    
  • Edit /var/lib/pgsql/data/pg_hba.conf and replace ident by md5

  • Restart database service:

    # /etc/init.d/postgresql restart
    
  • Download source code:

    $ git clone git://github.com/Igalia/libreplan.git
    
  • Compile project:

    $ cd libreplan/
    $ mvn clean install
    
  • Launch application:

    $ cd libreplan-webapp/
    $ mvn jetty:run
    
  • Go to http://localhost:8080/libreplan-webapp/

CutyCapt compilation

Like CutyCapt is not packaged for all distributions here are the instructions.

Ubuntu/Debian

  • Install requirements:

    # apt-get install subversion libqt4-dev libqtwebkit-dev qt4-qmake g++ make
    

    In Ubuntu Lucid 10.04 remove libqtwebkit-dev package.

  • Download source code:

    $ svn co https://cutycapt.svn.sourceforge.net/svnroot/cutycapt cutycapt
    
  • Compile:

    $ cd CutyCapt
    $ qmake CutyCapt.pro
    $ make
    
  • Install:

    # cp CutyCapt /user/bin/cutycapt
    

Fedora

  • Install requirements:

    # yum install subversion qt-devel qt-webkit-devel gcc-c++ make
    
  • Download source code:

    $ svn co https://cutycapt.svn.sourceforge.net/svnroot/cutycapt cutycapt
    
  • Compile:

    $ cd cutycapt/CutyCapt
    $ qmake-qt4 CutyCapt.pro
    $ make
    
  • Install:

    # cp CutyCapt /user/bin/cutycapt
    

openSUSE

  • Install requirements:

    # zypper install subversion libqt4-devel libQtWebKit-devel gcc-c++ make
    
  • Download source code:

    $ svn co https://cutycapt.svn.sourceforge.net/svnroot/cutycapt cutycapt
    
  • Compile:

    $ cd cutycapt/CutyCapt
    $ qmake-qt4 CutyCapt.pro
    $ make
    
  • Install:

    # cp CutyCapt /user/bin/cutycapt
    

Compilation profiles

There are different compilation profiles in LibrePlan. Check <profiles> section in root pom.xml to see the different profiles (there are also some profiles defined in pom.xml of business and webapp modules).

How to use profiles

Profiles active by default are used always if not deactivated. In order to activate or deactivate a profile you should use parameter -P for Maven command. For example:

  • Deactivate reports, userguide and i18n to save compilation time:

    mvn -P-reports,-userguide,-i18n clean install
    
  • Use production environment:

    mvn -Pprod,postgresql clean install
    

Compilation options

In LibrePlan there are two custom Maven properties, which allow you to configure some small bits in the project.

How to set compilation options

Maven properties have a default value, but you can change it using the parameter -D for Maven command to set the value of each option you want to modify. For example:

  • Set default.passwordsControl to false:

    mvn -Ddefault.passwordsControl=false clean install
    
  • Set default.passwordsControl and default.exampleUsersDisabled to false:

    mvn -Ddefault.passwordsControl=false -Ddefault.exampleUsersDisabled=false clean install
    

Tests

LibrePlan has a lot of JUnit test that by default are passed when you compile the project with Maven. You can use -DskipTests to avoid tests are passed always. Anyway, you should check that tests are not broken before sending or pushing a patch.

mvn -DskipTests clean install

MySQL

For MySQL users here are specific instructions.