Building and deploying Jetspeed-2 from source has the following prerequisites:
org.apache.portals.jetspeed-2
Settings pluginGroup, see:
PREREQUISITE: configuration of the Maven Settings pluginGroups
on the Overview page.
All the settings needed during the build and for a jetspeed demo Portal deployment need to be defined in a single file in the root folder
of the project: jetspeed-mvn-settings.xml
.
Note: this file is not provided but needs to be created manually first.
For convience however a sample file, jetspeed-mvn-settings-sample.xml
is
provided which can simply be copied to jetspeed-mvn-settings.xml
.
The jetspeed-mvn-settings-sample.xml
provides a default configuration using an Embbedded Derby database, and if that
suites you, probably the only changes needed are the location of the Derby database(s) and the deployment target directory
(org.apache.jetspeed.server.home
):
<properties> ... <!-- Your Tomcat Installation Path --> <org.apache.jetspeed.server.home>/home/demo/tomcat-7</org.apache.jetspeed.server.home> <org.apache.jetspeed.catalina.version.major>7</org.apache.jetspeed.catalina.version.major> <!-- Production jdbc driver artifact properties --> <org.apache.jetspeed.production.jdbc.driver.groupId>org.apache.derby</org.apache.jetspeed.production.jdbc.driver.groupId> <org.apache.jetspeed.production.jdbc.driver.artifactId>derby</org.apache.jetspeed.production.jdbc.driver.artifactId> <org.apache.jetspeed.production.jdbc.driver.version>10.3.2.1</org.apache.jetspeed.production.jdbc.driver.version> <!-- Production database name, JDBC url, JDBC driver name and connection information --> <org.apache.jetspeed.production.database.default.name>derby</org.apache.jetspeed.production.database.default.name> <org.apache.jetspeed.production.database.url>jdbc:derby:/tmp/derby/productiondb;create=true</org.apache.jetspeed.production.database.url> <org.apache.jetspeed.production.database.driver>org.apache.derby.jdbc.EmbeddedDriver</org.apache.jetspeed.production.database.driver> <org.apache.jetspeed.production.database.user></org.apache.jetspeed.production.database.user> <org.apache.jetspeed.production.database.password></org.apache.jetspeed.production.database.password> ... <!-- You can also configure test database properties below if you want to run unit tests. --> <!-- Test jdbc driver artifact properties --> <org.apache.jetspeed.test.jdbc.driver.groupId>org.apache.derby</org.apache.jetspeed.test.jdbc.driver.groupId> <org.apache.jetspeed.test.jdbc.driver.artifactId>derby</org.apache.jetspeed.test.jdbc.driver.artifactId> <org.apache.jetspeed.test.jdbc.driver.version>10.3.2.1</org.apache.jetspeed.test.jdbc.driver.version> <!-- Test database name, JDBC url, JDBC driver name and connection information --> <org.apache.jetspeed.test.database.default.name>derby</org.apache.jetspeed.test.database.default.name> <org.apache.jetspeed.test.database.url>jdbc:derby:/tmp/derby/testdb;create=true</org.apache.jetspeed.test.database.url> <org.apache.jetspeed.test.database.driver>org.apache.derby.jdbc.EmbeddedDriver</org.apache.jetspeed.test.database.driver> <org.apache.jetspeed.test.database.user></org.apache.jetspeed.test.database.user> <org.apache.jetspeed.test.database.password></org.apache.jetspeed.test.database.password> ... </properties>
Note: depending on your database platform, the value of the org.apache.jetspeed.production.database.default.name
property
can be one of the followings depending on your database platform:
The following jetspeed-mvn-settings.xml
provides a sample configuration using a PostgreSQL database:
<properties> ... <!-- Your Tomcat Installation Path --> <org.apache.jetspeed.server.home>/home/demo/tomcat-7</org.apache.jetspeed.server.home> <org.apache.jetspeed.catalina.version.major>7</org.apache.jetspeed.catalina.version.major> <!-- Production jdbc driver artifact properties --> <org.apache.jetspeed.production.jdbc.driver.groupId>postgresql</org.apache.jetspeed.production.jdbc.driver.groupId> <org.apache.jetspeed.production.jdbc.driver.artifactId>postgresql</org.apache.jetspeed.production.jdbc.driver.artifactId> <org.apache.jetspeed.production.jdbc.driver.version>8.3-603.jdbc3</org.apache.jetspeed.production.jdbc.driver.version> <!-- Production database name, JDBC url, JDBC driver name and connection information --> <org.apache.jetspeed.production.database.default.name>postgresql</org.apache.jetspeed.production.database.default.name> <org.apache.jetspeed.production.database.url>jdbc:postgresql://localhost/j2</org.apache.jetspeed.production.database.url> <org.apache.jetspeed.production.database.driver>org.postgresql.Driver</org.apache.jetspeed.production.database.driver> <org.apache.jetspeed.production.database.user>j2</org.apache.jetspeed.production.database.user> <org.apache.jetspeed.production.database.password>j2</org.apache.jetspeed.production.database.password> ... <!-- You can also configure test database properties below if you want to run unit tests. --> <!-- Test jdbc driver artifact properties --> <org.apache.jetspeed.test.jdbc.driver.groupId>postgresql</org.apache.jetspeed.test.jdbc.driver.groupId> <org.apache.jetspeed.test.jdbc.driver.artifactId>postgresql</org.apache.jetspeed.test.jdbc.driver.artifactId> <org.apache.jetspeed.test.jdbc.driver.version>8.3-603.jdbc3</org.apache.jetspeed.test.jdbc.driver.version> <!-- Test database name, JDBC url, JDBC driver name and connection information --> <org.apache.jetspeed.test.database.default.name>postgresql</org.apache.jetspeed.test.database.default.name> <org.apache.jetspeed.test.database.url>jdbc:postgresql://localhost/j2test</org.apache.jetspeed.test.database.url> <org.apache.jetspeed.test.database.driver>org.postgresql.Driver</org.apache.jetspeed.test.database.driver> <org.apache.jetspeed.test.database.user>j2test</org.apache.jetspeed.test.database.user> <org.apache.jetspeed.test.database.password>j2test</org.apache.jetspeed.test.database.password> ... </properties>
Alos, the following provides a sample configuration using a MySQL database:
<properties> ... <!-- Your Tomcat Installation Path --> <org.apache.jetspeed.server.home>/home/demo/tomcat-7</org.apache.jetspeed.server.home> <org.apache.jetspeed.catalina.version.major>7</org.apache.jetspeed.catalina.version.major> <!-- Production jdbc driver artifact properties --> <org.apache.jetspeed.production.jdbc.driver.groupId>mysql</org.apache.jetspeed.production.jdbc.driver.groupId> <org.apache.jetspeed.production.jdbc.driver.artifactId>mysql-connector-java</org.apache.jetspeed.production.jdbc.driver.artifactId> <org.apache.jetspeed.production.jdbc.driver.version>5.1.6</org.apache.jetspeed.production.jdbc.driver.version> <!-- Production database name, JDBC url, JDBC driver name and connection information --> <org.apache.jetspeed.production.database.default.name>mysql5</org.apache.jetspeed.production.database.default.name> <org.apache.jetspeed.production.database.url>jdbc:mysql://localhost:3306/j2</org.apache.jetspeed.production.database.url> <org.apache.jetspeed.production.database.driver>com.mysql.jdbc.Driver</org.apache.jetspeed.production.database.driver> <org.apache.jetspeed.production.database.user>j2</org.apache.jetspeed.production.database.user> <org.apache.jetspeed.production.database.password>j2</org.apache.jetspeed.production.database.password> ... <!-- You can also configure test database properties below if you want to run unit tests. --> <!-- Test jdbc driver artifact properties --> <org.apache.jetspeed.test.jdbc.driver.groupId>mysql</org.apache.jetspeed.test.jdbc.driver.groupId> <org.apache.jetspeed.test.jdbc.driver.artifactId>mysql-connector-java</org.apache.jetspeed.test.jdbc.driver.artifactId> <org.apache.jetspeed.test.jdbc.driver.version>5.1.6</org.apache.jetspeed.test.jdbc.driver.version> <!-- Test database name, JDBC url, JDBC driver name and connection information --> <org.apache.jetspeed.test.database.default.name>mysql5</org.apache.jetspeed.test.database.default.name> <org.apache.jetspeed.test.database.url>jdbc:mysql://localhost:3306/j2test</org.apache.jetspeed.test.database.url> <org.apache.jetspeed.test.database.driver>com.mysql.jdbc.Driver</org.apache.jetspeed.test.database.driver> <org.apache.jetspeed.test.database.user>j2test</org.apache.jetspeed.test.database.user> <org.apache.jetspeed.test.database.password>j2test</org.apache.jetspeed.test.database.password> ... </properties>
Note: To run unit tests properly with MySQL database, you should enable InnoDB storage engine and use InnoDB tables. InnoDB is a transactional-safe (ACID compliant) storage engine for MySQL database. See the documentation of MySQL for details.
A few changes and additions are needed to the default provided configuration of Tomcat to support proper Portlet API session management requirements and Jetspeed portlet application management integration:
<TOMCAT_HOME>/conf/server.xml
:emptySessionPath="true"
<TOMCAT_HOME>/conf/context.xml
:<Manager pathname=""/>
<TOMCAT_HOME>/conf/tomcat-users.xml
:manager-script
to be used by Jetspeed to communicate with the Tomcat Manager application:
<user username="j2deployer" password="<<em>strong</em> password<" roles="manager-script"/>
jetspeed.properties
file read by
the portal at runtime, but overriding and more secret values can be specified in override.properties
.When building Jetspeed 2.3 from a released source distribution archive or a SVN checkout of a corresponding release tag the following step can be skipped.
However, when building a specific Jetspeed 2.3.x SNAPSHOT or branch SVN checkout which has not (yet) been released, you will have to run the following command first, but only the first time (for the checkout version):
$mvn install -P init
The above command will ensure the custom Jetspeed Maven Plugins as well as the portal resources for this build version are prebuild and installed in your local Maven repository as they might not be available from a remote Maven repository.
Without the above bootstrap build an initial/first $mvn clean
execution might lead to a BUILD FAILURE: "A required plugin was not found" error.
A full build and installation of all the Jetspeed-2 components into your local Maven repository is done using the standard Maven install goal:
$mvn install
First make sure to setup Tomcat 6 (6.0.33+) locally and apply the above described Tomcat configuration changes first.
Also make sure to configure the appropriate Tomcat major version (org.apache.jetspeed.catalina.version.major
) and installation path
(org.apache.jetspeed.server.home
) in your local jetspeed-mvn-settings.xml
file in the root of the Jetspeed project.
After first building and installing the Jetspeed project using $mvn install
as described above, deploy the
Jetspeed Demo Portal to Tomcat using the following command:
$mvn jetspeed:mvn -Dtarget=demo
Thereafter start Tomcat (in a separate console):
Note that the setting of CATALINA_OPTS is optional in the following examples. (See Note on Permanent Generation Size of Your JVM for detail.)
$ cd $TOMCAT_HOME/bin $ export CATALINA_OPTS="-Xmx256m -XX:MaxPermSize=128m" $ ./catalina.sh run
For login, use one of the following username/password combinations: admin/admin, user/user, jetspeed/jetspeed
Note: You may need to increase the permanent generation size of your JVM when there are a lot of Servlets, JSP's
or when script portlets are used, in order to avoid OutOfMemoryError
errors.
By default, it is 64MB. Increasing it to be -XX:MaxPermSize=128m
might be a good start.
Please see http://wiki.apache.org/tomcat/FAQ/Memory for detail.
Using the jetspeed:mvn plugin, several defined custom build and installation tasks (targets) are provided for the Jetspeed Portal project itself.
The complete list of available targets can be queried using the special -Dlist
command line parameter:
$mvn -o jetspeed:mvn -Dlist
pom.xml
build file for further reference.
There are four major modes the portal can be built and deployed under:
test |
Executing the
Of course the same effect can be achieved by just executing |
testdb, proddb |
Executing one of these targets will (re)create either a test or production database (schema), using the database configuration properties from
the Note: this target can be executed from within any (sub) module folder within the project. |
ui-seed, min-ui-seed, demo-seed, min-seed and ui-db, min-ui-db, demo-db, min-db |
Besides (re)creation a (production) database using the
These seed files are dynamically retrieved from a previously build and installed or downloaded
As the |
demo-install |
This target will simply invoke the default Maven goal, (which is install), against the |
ui, min-ui, demo, min |
These targets will perform the actual deployment of the Jetspeed Portal to the Tomcat installation along with all database configuration and seeding. The XML file system based PSML implementation is used and its pages (re)deployed by default. Note: executing these targets directly assumes all the required Jetspeed artifacts already are build and installed. |
ui-nodb, min-ui-nodb, demo-nodb, min-nodb |
These targets only perform the deployment of the Jetspeed Portal. The database is left untouched, (the XML file system based PSML pages are redeployed). |
ui-dbpsml, min-ui-dbpsml, demo-dbpsml, min-dbpsml |
These targets are variants of the |
ui-dbpsml-nodb, min-ui-dbpsml-nodb, demo-dbpsml-nodb, min-dbpsml-nodb |
These targets are variants of the |
By default, running test-cases is disabled for Jetspeed-2 because it is very time-consuming and also requires the setup and initialization of a dedicated test database every time!
But if you are a Jetspeed committer or otherwise would like to run the test-cases anyway, the testdb jetspeed:mvn target can be used to setup and initialize the test database:
$mvn jetspeed:mvn -Dtarget=testdb
Or you can run the following command to automatically execute the testdb target first before running a test build:
$mvn jetspeed:mvn -Dtarget=test-install
Note: Running the test-cases requires (and only for this) the proper configuration of the org.apache.jetspeed.test.database.* properties in jetspeed-mvn-settings.xml
Additional note: Probably you need to configure some memory settings for maven to run all the tests properly because some test cases require more memory than the default memory size.
You can configure memory settings for maven by setting the environment variable 'MAVEN_OPTS'. For example:
$export MAVEN_OPTS="-Xmx128m -XX:MaxPermSize=128m"
The following profiles can be supplied when building.
mvn -P all |
specified that all modules (the API, plugins, portal resources, commons, components and applications) be built. |
mvn -P init |
specified some modules to be initialized first (the API, plugins and portal resources) |
mvn -P test |
specified that all modules (the API, plugins, portal resources, commons, components and applications) be built, with the property setting, -DskipTests=false |