Software Portal/Setup

From openSUSE


< Software Portal | Ideas - Look - Meetings - Setup - Tasks


Contents

How to set up the development environment

Eclipse

It's an Eclipse project so you probably want to use Eclipse to browse around the source code. Note that I'm using Eclipse 3.3+ integration snapshots but anything above 3.2.2 should work fine. Benjamin is using Netbeans, so that works too.

Download it from here (3.3.1.1 stable)

When using Eclipse, you should install the following plugins as well:

You will also need JavaSE 6 (add it to Eclipse's list of installed JREs as well).

Maven

To build and test, you'll need Maven 2. Download it from here: download Maven 2.0.8

To install, do the following as root:

mkdir -p ~/download/maven2
cd ~/download/maven2
wget http://apache.belnet.be/maven/binaries/maven-2.0.8-bin.tar.bz2
su
tar -C /usr/local -xjf maven-2.0.8-bin.tar.bz2
ln -s maven-2.0.8 /usr/local/maven
echo 'PATH=$PATH:/usr/local/maven/bin; export PATH' >> /etc/profile.d/maven.sh
. /etc/profile.d/maven.sh

You could also use a maven rpm from the buildservice: http://software.opensuse.org/search?baseproject=ALL&p=1&q=maven

Sources

Now check out the sources using SVN:

mkdir -p ~/src/projects/softwareportal
cd ~/src/projects/softwareportal
svn checkout https://forgesvn1.novell.com/svn/opensuse/trunk/infrastructure/softwareportal

Database Setup

Execute the following commands as root:

mysqladmin create swp
echo 'GRANT ALL ON swp.* TO swp@localhost IDENTIFIED BY "swp"; FLUSH PRIVILEGES;' | mysql
mysqladmin create swptest
echo 'GRANT ALL ON swptest.* TO swp@localhost IDENTIFIED BY "swp"; FLUSH PRIVILEGES;' | mysql

Database settings are in

  • src/test/resources/dbunit.jdbc.properties for Integration tests (default: user=swp, password=swp, database=swptest), and
  • src/main/webapp/WEB-INF/jdbc.properties for the web application (default: user=swp, password=swp, database=swp)

Tables will be created on the fly by the tests.

Java

Make sure the latest version of java is in your path (not as root) add the following to the "profile" file in /home/username (if the file does not exist create it):

export JAVA_HOME=/usr/java/jdk1.6.0_03
export PATH=$JAVA_HOME/bin:$PATH

(You can edit /etc/profile.d/alljava.[sh/csh] according to the jdk folders - in SuSE 10.3).

Building and testing

From the directory where you checked out the sources (should be ~/src/projects/softwareportal/swp), run the following command (not as root):

mvn eclipse:eclipse
mvn -Declipse.workspace=/home/`whoami`/workspace eclipse:add-maven-repo

The command above will download all the dependencies through Maven2 (which will take some time, a lot of jars to download), including the sources (where possible), and generate the Eclipse project accordingly.

Now, create local config files for buildservice access:

cp src/test/resources/bs.properties-dist src/test/resources/bs.properties
cp src/main/webapp/bs.properties-dist src/main/webapp/bs.properties

Next, to compile, run the unit tests, generate test and coverage reports:

mvn site

Just point your browser to target/site/index.html -- the test reports are under "Project Reports" in the left-hand side menu.

Running the web application

You can start the web application with the embedded Jetty plugin:
mvn -o jetty:run

(-o is for Maven's offline mode and skips checking for jar dependency updates on the internet, highly recommended except for the first build or run)

Point your browser to http://localhost:8888/web and log in as user "admin" with password "admin" (that user has the ADMIN role and is automatically added on startup, which will obviously be removed in production).