7.2 Setting up for Automated Build

Before building and deploying from the command line, it is important to clean up the artifacts that Eclipse has deployed. In this section the GreenPages application will be undeployed within Eclipse and all of the GreenPages bundles built from the command line.

Right-click on the greenpages application in the Servers view and select Remove. Once this is complete close Eclipse: it is no longer needed.

Run the following command from a command prompt with the $GREENPAGES_HOME/start as the current directory. This will build the individual bundles that make up the GreenPages application:

mvn clean install

The first time this is run will cause Maven to download quite a few packages. It is likely also that this does not build successfully on the first try, due to warnings from Bundlor. These warnings are due to the lack of information regarding some of the packages required by greenpages.db and greenpages.web. For example warnings like the following may be issued:

[WARNING] Bundlor Warnings:
[WARNING]     <SB0001W>: The import of package javax.sql does not specify a version.
[WARNING]     <SB0001W>: The import of package org.apache.commons.dbcp does not specify a version.
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Bundle transformer returned warnings.
       Please fix manifest template at '/opt/greenpages-2.1.0.RELEASE/start/greenpages.db/template.mf'
       and try again.

which indicate that there is no information in the template.mf file in the greenpages.db project to inform Bundlor what version of these packages to generate in the MANIFEST.MF for that bundle.

To correct these problems add the following lines to the template.mf file for the greenpages.db bundle:

Import-Template: javax.sql;version="0",
 org.apache.commons.dbcp;version="[1.2.2.osgi, 1.2.2.osgi]"

and, if further warnings are issued, in the template.mf file of other bundles (for example, greenpages.jpa).

When the mvn command returns successfully, go to the next step.