With Maven2 and Jetspeed Maven Plugins, you can build Jetspeed 2.2 and deploy Jetspeed Demo Portal very easily. In most cases, just following this section could be enough to build and deploy Jetspeed 2.2.
You need the following prerequisites:
All the settings needed during the build (and the jetspeed-demo Portal deployment) are isolated in one single file in the root folder
of the project: jetspeed-mvn-setttings.xml
.
To make it easy to create your own jetspeed-mvn-settings.xml, a sample file, jetspeed-mvn-setttings-sample.xml
is provided which you can simply copy to jetspeed-mvn-setttings.xml
and modify only
the properties you'll need.
The jetspeed-mvn-setttings-sample.xml
provides a default configuration using an Embbedded Derby database, and if that
suites you, probably the only changes needed will be for the location of the Derby database(s) and the deployment target directory for the
jetspeed-demo Portal:
<properties> ... <!-- Your Tomcat Installation Path --> <org.apache.jetspeed.server.home>/home/demo/tomcat-5.5</org.apache.jetspeed.server.home> <!-- 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> ... </properties>
Note: depending on your database platform, the value of 'org.apache.jetspeed.production.database.default.name' property can be one of the followings:
The following jetspeed-mvn-settings.xml
provides a sample configuration using a MySQL database.
<properties> ... <!-- Your Tomcat Installation Path --> <org.apache.jetspeed.server.home>/home/demo/tomcat-5.5</org.apache.jetspeed.server.home> <!-- 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> ... </properties>
If, and only if, no (full) build has been done yet, a subset of the build has to be performed once first:
$mvn install -P init
This will ensure the required Jetspeed-2 Maven plugins are build and installed as well as the jetspeed-portal-resources artifact.
Performing a full build of all the Jetspeed-2 components, as well as the jetspeed-demo Portal is plain Maven-2 simple:
$mvn install
This requires downloading and installing your own Tomcat
(for Jetspeed-2.2 at least version 5.5.26 is now required!)
Once you've installed Tomcat, adjust the org.apache.jetspeed.server.home
property
in the jetspeed-mvn-settings.xml file to point at the installation directory.
You can deploy the Jetspeed Demo Portal to your Tomcat installation by using the following command:
$mvn org.apache.portals.jetspeed-2:jetspeed-mvn-maven-plugin:mvn -Dtarget=demo
<settings xmlns="http://maven.apache.org/POM/4.0.0"> <pluginGroups> <!-- add the following line to shorten the command invoking the Jetspeed Maven Plugin. --> <pluginGroup>org.apache.portals.jetspeed-2</pluginGroup> </pluginGroups> </settings>
$mvn jetspeed:mvn -Dtarget=demo
Start your Tomcat:
$ $TOMCAT_HOME/bin/catalina.sh run
Use the jetspeed-demo Portal: http://localhost:8080/jetspeed
For login, use one of the following username/password combinations: admin/admin, user/user, jetspeed/jetspeed
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, -Dmaven.test.skip=false |
The -o offline option can be specified with the commands documented here to force Maven2 to use only the local repository. This can be invaluable in the event the main Maven2 repositories are down and the build insists upon validating a missing or troublesome POM.
With the new jetspeed-mvn plugin, building the Jetspeed-2 Portal itself from source as well as building and deploying the default jetspeed-demo portal is now extremely easy.
In most cases, just following the first section could be enough, but because Jetspeed Maven Plugins provide many optional tasks, you can make use of those useful options.
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 following command is used to setup and initialize the test database:
$mvn jetspeed:mvn -Dtarget=testdb
Thereafter, enabling the test-cases during a build is done by using profile test
:
$mvn install -P test
But, to make it even a little more easier, another jetspeed:mvn target is provided which already combines the above two steps in one:
$mvn jetspeed:mvn -Dtarget=test-install
The production database configuration provided by the Jetspeed-2 Portal project itself is primarly intended to be used by the developers using the jetspeed-demo Portal.
Manual initializing or reinitializing of the production database is done using the following command:
$mvn jetspeed:mvn -Dtarget=proddb
The above command however will only created the required database tables, not seed it with (demo) data, for which the following command is needed:
$mvn jetspeed:mvn -Dtarget=demo-seed
As the above two commands usually goes together, the following command can be used instead to automatically invoke both:
$mvn jetspeed:mvn -Dtarget=demo-db
The jetspeed-demo Portal is an example custom Portal project used by the Jetspeed-2 committers for development and testing, but can of course also be used as real "demo" for other purposes.
The full setup and usage of the jetspeed-demo Portal requires the following steps:
Task | Command |
---|---|
building and installing the jetspeed-demo war |
$mvn jetspeed:mvn -Dtarget=demo-install |
database initialization and seeding |
$mvn jetspeed:mvn -Dtarget=demo-db |
setting up a (clean) Tomcat server |
This requires downloading and installing your own Tomcat (for Jetspeed-2.2 at least version 5.5.26 is now required!)
Once you've installed Tomcat, adjust the org.apache.jetspeed.server.home property in the jetspeed-mvn-settings.xml file to point at the installation directory.
|
deploying the jetspeed-demo Portal |
$mvn jetspeed:mvn -Dtarget=demo-deploy |
performing everything above (except Tomcat installation) with a single command instead |
$mvn jetspeed:mvn -Dtarget=demo |
starting Tomcat |
$ $TOMCAT_HOME/bin/catalina.sh run |
Using the jetspeed-demo Portal |
http://localhost:8080/jetspeed For login, use one of the following username/password combinations: admin/admin, user/user, jetspeed/jetspeed |
There is one optional feature for building and deploying the jetspeed-demo Portal: storing and using PSML in the database. This requires using an additional profile, dbpsml, during building the jetspeed-demo war as well as slightly different jetspeed:mvn targets to execute. To execute all of that with one command, use:
$mvn jetspeed:mvn -Dtarget=demo-dbpsml
Further detail of the different jetspeed:mvn targets and configurations used for the dbpsml demo can be found in the jetspeed-mvn-plugin configuration within the root pom.xml.