Building from source code

Posted by Paolo Predonzani
on April 14, 2009


In this short tutorial I'll guide you through the simple process of downloading and building Portofino from source code.

Downloading the source code

There are two alternative ways to download the code: as a zip/tgz archive or using Subversion. Choose the one you prefer.

Downloading the zip/tgz archive

Visit the download page, follow the link to SouceForge, select the 'manydesigns-portofino' package. Click on one of the files that contain "src" in the name. They are:
  • portofino-3.1-os-src.tar.gz
  • portofino-3.1-os-src.zip
The download will start from a mirror server that is close to you.

Installing the dependencies

Portofino depends on a number of other software libraries and components. We use Maven to manage such dependecies and Maven can download them by talking to certain public repositories, such as http://repo1.maven.org/.

We don't need to worry about this process, which happens automatically. However, Portofino depends on four jar files that cannot be found on public repositories, which means that you'll have to install them manually.

First of all, make sure Maven is installed on your system.

$ mvn -version
Maven version: 2.0.10

If necessary, download and install from here: http://maven.apache.org/

The four libraries, along with the download website and installation instructions are listed below:

CUP 1.0
http://www2.cs.tum.edu/projects/cup/

mvn install:install-file -DgroupId=cup -DartifactId=cup \
    -Dversion=1.0 -Dpackaging=jar -Dfile=cup.jar


Mime Type Detection Utility 1.0
http://sourceforge.net/projects/mime-util/

mvn install:install-file -DgroupId=mime-util -DartifactId=mime-util \
    -Dversion=1.0 -Dpackaging=jar -Dfile=mime-util.jar


FontBox 0.1.0
http://sourceforge.net/projects/fontbox/

mvn install:install-file -DgroupId=fontbox -DartifactId=fontbox \
    -Dversion=0.1.0 -Dpackaging=jar -Dfile=fontbox-0.1.0.jar


JavaMail API 1.4.1
http://java.sun.com/products/javamail/

mvn install:install-file -DgroupId=smtp -DartifactId=smtp \
    -Dversion=1.4 -Dpackaging=jar -Dfile=smtp-1.4.jar

mvn install:install-file -DgroupId=mailapi -DartifactId=mailapi \
    -Dversion=1.3 -Dpackaging=jar -Dfile=mailapi-1.3.jar


Building with Maven

Now you can compile/build the targets:

$ cd portofino
$ mvn install

Maven will run, logging every operation, and finally will confirm a successful build:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] manydesigns-portofino ................................. SUCCESS [4.124s]
[INFO] manydesigns-elements .................................. SUCCESS [4.094s]
[INFO] manydesigns-elements-struts2 .......................... SUCCESS [1.045s]
[INFO] manydesigns-portofino-jar ............................. SUCCESS [10.600s]
[INFO] manydesigns-portofino-rad ............................. SUCCESS [0.875s]
[INFO] manydesigns-portofino-war ............................. SUCCESS [5.954s]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 29 seconds
[INFO] Finished at: Thu Nov 19 10:57:05 CET 2009
[INFO] Final Memory: 23M/63M
[INFO] ------------------------------------------------------------------------

The target .war file is available at:

portofino-war/target/portofino-war-3.1.war

This is it!

Important notice: if you see an error message like the one below...

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) cup:cup:jar:1.0

  Try downloading the file manually from the project website.

...make sure you follow the instructions in "Installing the dependencies". Then come back to this section and repeat the build.