Building from source code
Posted by Paolo Predonzani
on April 14th, 2010
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://www.oracle.com/technetwork/java/javamail/index.html
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.
Notes on installation
During installation you can receive an error like this:
[INFO] Building manydesigns-portofino-jar [INFO] task-segment: [install] [INFO] ------------------------------------------------------------------------ [INFO] [resources:resources {execution: default-resources}] [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 11 resources [INFO] skip non existing resourceDirectory /Users/proprietario/portofino/portofino-jar/src/main/jasperreports [INFO] artifact commons-digester:commons-digester: checking for updates from jaspersoft [WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '0a628971788d53103df129e442c345f619bcd127'; remote = '<!DOCTYPE' - RETRYING [WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = 'a1c6130458dcf8647ce7ccbed58b509bdf1a9b6c'; remote = '<!DOCTYPE' - IGNORING [INFO] artifact commons-digester:commons-digester: checking for updates from central [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Failed to resolve artifact. Unable to get dependency information: Unable to read local copy of metadata: Cannot read metadata from '/Users/proprietario/.m2/commons-digester/ commons-digester/maven-metadata-jaspersoft.xml': end tag name </td> must match start tag name <span> from line 261 (position: END_TAG seen ...</span></span></td>... @265:173) commons-digester:commons-digester:jar:null from the specified remote repositories: central (http://repo1.maven.org/maven2), jaspersoft (http://www.jasperforge.org/maven2) Path to dependency: 1) com.manydesigns:portofino-jar:jar:3.1.8 2) jasperreports:jasperreports:jar:3.5.0
This is due to a known error in the jasper reports package in the remote repository. You can avoid this adding the Jasper Software repository in the file .m2/settings.xml
An example of settings.xml follows.
<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <activeProfiles> <activeProfile>compiler</activeProfile> </activeProfiles> <profiles> <profile> <id>compiler</id> <repositories> <repository> <id>jaspersoft</id> <name>Jasper Soft</name> <url>http://stage.jasperforge.org/maven2/</url> <releases> <enabled>false</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> </profile> </profiles> <offline>false</offline> </settings>