GreenPages uses Apache Maven as its primary build system. Each module of the application can be built separately and the entire application can built and assembled into a PAR file from a single location. To build the PAR file:
Make $GREENPAGES_HOME/solution
the current directory.
Run the command
mvn package
. The first time this is run quite a lot of files will be downloaded
from Maven repositories and SpringSource repositories. Subsequent runs will not need to do this.
Verify that the
greenpages-1.0.0.SNAPSHOT.par
file exists in
$GREENPAGES_HOME/greenpages/target
.
Building on Windows:
cd %GREENPAGES_HOME%\solution mvn package
Building on UNIX:
cd $GREENPAGES_HOME/solution mvn package
Unlike traditional Java EE applications, GreenPages does not package all of its dependencies inside its deployment unit. Instead, it relies on the mechanisms of OSGi to locate its dependencies at runtime. When running an OSGi application on dm Server, these dependencies can be loaded into memory as needed, but first they must be made available to dm Server.
The Maven build included with GreenPages uses the dependency:copy-dependencies
plugin to gather
all the artifacts that GreenPages depends on that are not supplied by the OSGi runtime. These dependencies
can then be installed into the dm Server repository. Dependencies are gathered automatically during the package
phase. These dependencies can be found in $GREENPAGES_HOME/greenpages/target/par-provided
.
To install dependencies
simply copy all the bundles from this directory into $DMS_HOME/repository/bundles/usr
.
Installing dependencies on Windows:
cd %GREENPAGES_HOME%\solution\greenpages copy target\par-provided\* %DMS_HOME%\repository\bundles\usr
Installing Dependencies on UNIX:
cd $GREENPAGES_HOME/solution/greenpages cp target/par-provided/* $DMS_HOME/repository/bundles/usr
GreenPages uses the H2 database to store all its data. Before the application can be started, the database server must be started and the database populated with data.
Make $GREENPAGES_HOME/db
the current directory.
Run the database startup script appropriate to the operating system.
Run the data population script appropriate to the operating system.
Starting and configuring the database on Windows:
cd %GREENPAGES_HOME%\db run data
Starting and configuring the database on UNIX:
cd $GREENPAGES_HOME/db ./run.sh & ./data.sh
After ./run.sh &
press Return to continue.
These instructions need only be run once to start a database server for H2; this will continue to run in the background. A browser window offering a connection to the database may open: this should be closed.
To install the GreenPages PAR into dm Server and start it:
Copy the GreenPages PAR to the $DMS_HOME/pickup
directory.
Start dm Server.
Verify that GreenPages starts correctly by checking in the dm Server output for the log message:
<SPDE0010I> Deployment of 'greenpages' version '1.0.0.SNAPSHOT' completed.
Installing and starting GreenPages on Windows:
cd %DMS_HOME% copy %GREENPAGES_HOME%\solution\greenpages\target\greenpages-1.0.0.SNAPSHOT.par pickup\ bin/startup.bat
Installing and starting GreenPages on UNIX:
cd $DMS_HOME cp $GREENPAGES_HOME/solution/greenpages/target/greenpages-1.0.0.SNAPSHOT.par pickup/ bin/startup.sh