Skip to content
Adriana Cristina Draghici edited this page Jun 25, 2013 · 18 revisions

Setup and prerequisites

In order to start developing Teamshare you must:

  • install Java 1.7 (Oracle or OpenJDK) and Python 2.7
  • install Eclipse
  • install [m2e](http://www.eclipse.org/m2e/) Maven plugin for Eclipse
  • install maven
  • install zeroc-ice34
  • install swig, libevent, libevent-dev
  • clone read+write the Teamshare repository
  • clone the forked libswift repository, simple-api branch
  • add zeroc-ice34 dependency to the project (see this wiki)
  • create libswift.so and copy it into a lib/ folder in the project's root (see this wiki)
  • import project in Eclipse as an Existing Maven Project

#Maven

Teamshare uses Maven for building.

If you don't have Maven (3 or greater) installed on your machine, do so:

on Ubuntu: sudo apt-get install maven
on Fedora: sudo yum install maven

If you have Maven2 already installed, we strongly recommend upgrade to 3, even though Maven3 is backwards compatible with Maven2, but has more advantages, such as faster building time and a more strict POM validation.

Maven projects are configured using a Project Object Model, which is stored in a pom.xml file. You can find this file in the root of the repository. It specifies all the dependencies needed by the project and the plugins for compiling and executing the code.

The project can be compiled from the command line by running in its root directory:

 mvn compile

Creating a Maven Project in Eclipse

Import existing Maven project:

  • Import -> Maven -> Existing Maven projects
    • the current workspace must be a different folder than the one containing pom.xml

Managing project dependencies

If your project requires libraries that are managed by public Maven repositories, then you don't need to download them, you just have to specify them in the pom.xml configuration file. When needed, Maven will automatically download the libraries and store them in a local cache.

Artifacts

Project dependencies are specified as artifacts. A Maven artifact is identified by a Group Id, an Artifact Id and an optional version string. The artifact is the resulting output of the Maven build, generally a jar or other executable file.

Adding artifacts

You can edit the pom.xml in Eclipse by just modifying the pom.xml file directly or using the graphical interface.

To add a new dependency you can open the pom.xml, select de Dependencies tab and add its Group Id and Artifact Id if you already know them. If you don't, then you can search the library on one of Maven repositories such as Maven Central Repository or directly from the Select Dependency window's search field by entering the name of the library.

Take for example log4j logging library, you would obtain the following search results on the Maven Central Repository. The results show the Group Id and the Artifact Id. You can input them in the Select Dependency window, or directly download the pom.xml and copy paste the <dependency> block.

ZeroC Ice and Maven

Teamshare uses ZeroC Ice, an object-oriented middleware for remote procedure calls. Unfortunately, this library is not managed by any public Maven repository, therefore a zeroc-ice dependency needs to be manually added to the local repository.

To do add the zeroc-ice dependency, follow the steps:

  1. Install Ice on your machine from your Linux repository or download it from ZeroC website
  2. Locate Ice library JAR. In Ubuntu and Fedora, if installed through apt/yum, its location is '/usr/share/java/zeroc-ice-3.4.jar'.
  3. Add the zeroc-ice-3.4.jar to the local Maven repository by running on the command line:
mvn install:install-file -Dfile="$ICE_LIBRARY_JAR" \
    -DgroupId=com.zeroc.ice -DartifactId=zeroc-ice \
    -Dversion=3.4 -Dpackaging=jar

where $ICE_LIBRARY_JAR is the JAR file path previously located.

Building libswift with Teamshare

Teamshare depends on libswift a PPSPP implementation for multi-party content dissemination, similar with BitTorrent. Because this library is written in C++ and is included in a different repository it needs to be compiled separately, and integrated into Teamshare build. To do so, follow the steps:

  • Install SWIG on your machine, a tool for wrapping the Java and the C/C++ code.
    • On Ubuntu run: sudo apt-get install swig
  • Clone libswift for Teamshare:

git clone [email protected]:open-software-solutions/libswift.git -b simple-api

  • Go in the Teamshare repository directory in src/main/swig and run the script build-swig.sh with an argument that points to libswift repository directory:
cd "$TEAMSHARE_PATH/src/main/swig/"
./build-swig.sh "$LIBSWIFT_PATH"
  • This will generate C/C++ and Java wrapping code for JNI.
  • Got to libswift repository directory and build it:
cd "$LIBSWIFT_PATH"
make clean
make libswift
  • Copy libswift.so from libswift repository directory to the lib/ directory of Teamshare repository directory (create lib if it does not exist):

cp "$LIBSWIFT_PATH/libswift.so" "$TEAMSHARE_PATH/lib/"

If you encounter errors when building libswift:

  • check whether or not you have libevent and libevent-dev installed, if not, install them
  • check the paths from $LIBSWIFT_PATH, make sure they are for the correct version of your Java SDK.

Clone this wiki locally