Maven-2 Plugin Overview

Adding functionality to Maven is done through the Maven plugin mechanism. Maven comes shipped with numerous plugins and provides an extensible framework for writing custom plugins. Details on custom Maven plugins can be found in the Writing a Plugin section of Maven's web site.

Jetspeed 2 has developed a custom Maven plugin that centralizes most common build goals required to build a Jetspeed 2 based portal application. This provides many benefits:

  • Better reusability of common build goals. Developers creating a new portal application can leverage the Jetspeed 2 Maven plugin for common build operations.
  • The ability to quickly get started with a portal application. With the goal j2:portal.genapp a new portal application can be created. The developer of the new application can reuse the Jetspeed 2 Maven plugin goals for common build operations for quickStart, portlet deployment, etc.
  • Preparation for future migration to Maven 2 (M2). With M2, custom goals are encapsulated in plugins, maven.xml is deprecated. By centralizing most of the Jetspeed 2 build goals to the Jetspeed 2 Maven plugin, migration to M2 should be much easier.

Portal Application creation and configuration Goals

Creating a new Portal Application

Goal Description
j2:portal.genapp Generates or updates a custom portal application.
j2:portal.genapp.minimal Works similar to j2:portal.genapp. However, it will only copy the following directories/files from WEB-INF/pages.
  • /WEB-INF/pages/Administrative/** (all contents)
  • /WEB-INF/pages/page.security

Configuring and updating a Portal Application

The j2:portal.genapp goal above is actually no more than a wrapper around several (sub)goals which can also be used individually to update and configure your portal application:

Goal Description
j2:portal.copy.webapp Copies the (static) Jetspeed 2 portal web resource from the plugin to the ${org.apache.jetspeed.portal.webapp.dir} folder.

Running this goal again will not clear out previous resources but will overwrite existing resources.

If you need to upgrade to a newer version of the Jetspeed 2 portal you should clear out these resources yourself first. By default, the target folder is configured within the maven default target folder and running the clear goal will do exactly that.
j2:portal.copy.webapp.minimal Similar to j2:portal.copy.webapp However, it will only copy the following directories/files from WEB-INF/pages.
  • /WEB-INF/pages/Administrative/** (all contents)
  • /WEB-INF/pages/page.security
j2:portal.conf.project Creates a new maven or updates an existing portal project configuration in the ${org.apache.jetspeed.portal.home.dir} folder.
It creates a hiearchy of 5 maven project files:
  • project-info.xml
  • core-build.xml extends project-info.xml
  • jetspeed-components.xml extends core-build.xml
  • full-portal.xml extends jetspeed-components.xml
  • project.xml extends full-portal.xml
Of the above files, the first and the last (project-info.xml and project.xml) may be modified to provide additional project information and configuration and will not be updated by this goal again. Only the other 3 files will be rewritten by this goal. If you need to upgrade to a newer version of the Jetspeed 2 portal your own customization will be preserved.

Additionally, you can add your own maven.xml and/or project.properties or build.properties to further customize your portal. These also will be preserverd when you run this goal again.
j2:portal.conf.sql Generates the portal sql schema DDL for the configured database(s) under the ${org.apache.jetspeed.portal.sql.dir}, as well as copies over statically defined common and selected database specific sql DML and DDL (possibly overriding generated DDL).

The content of the sql target folder is cleared out first when this goal is run.
j2:portal.conf.ojb Copies the OJB configuration, filtered for the currently selected production database to the ${org.apache.jetspeed.portal.target.dir} folder.

As default, the above target folder is configured under the default maven war target folder. The maven clear goal will also remove this filtered OJB configuration.
j2:portal.conf.ldap Copies the LDAP configuration, to the ${org.apache.jetspeed.portal.target.dir} folder.
j2:portal.conf.jetspeed Copies the filtered jetspeed.properties portal configuration to the ${org.apache.jetspeed.portal.target.dir} folder.

As default, the above target folder is configured under the default maven war target folder. The maven clear goal will also remove this filtered jetspeed.properties file.
j2:portal.conf.tomcat Copies a filtered Tomcat context descriptor, containing current database connection configuration to the ${org.apache.jetspeed.portal.conf.dir} folder.

Based on the ${org.apache.jetspeed.catalina.major.version} setting, a Tomcat 6.x type template context descriptor will be used.

The filtered Tomcat context descriptor will be copied to the Tomcat server by the j2:portal.deploy goal.

If you need to change the Tomcat major version and/or database connection configuration, you need to run this goal again before (re)deploying your portal.

As default, the above target folder is configured under the default maven target folder. The maven clear goal will remove this filtered context descriptor file.

Portal Application Deployment Goals

Quickstart deployment goals

Several goals are available for quickly deploying the Portal Application together with a predefined set of Portlet Applications and optionally with creating and seeding the portal database.

Goal Description
j2:doStart A generic goal for deploying the portal application and setting up the required dependencies for the configured Tomcat Server (shared libraries, portal application context, etc.).

This goal requires the plugin property deployType to be set. The default value is "j2:fullDeploy" (see below).

If plugin property recreateDB is set, goal j2:db.recreate is invoked.
All existing Jetspeed 2 standard and demo portlet applications are removed through goal j2:remove.wars.
The shared dependecies are copied to the Tomcat Server with goal j2:copy.shared.deps.
And finally, the set deployType plugin property value is used to run a specific deploy goal.
j2:quickStart Invokes j2:doStart with deployType="j2:fullDeploy" and recreateDB=true.
j2:nodbQuickStart Invokes j2:doStart with deployType="j2:nodbfullDeploy" and recreateDB=false.
j2:basicStart Invokes j2:doStart with deployType="j2:basicDeploy" and recreateDB=true.
j2:nodbBasicStart Invokes j2:doStart with deployType="j2:nodbBasicDeploy" and recreateDB=false.
j2:minStart Invokes j2:doStart with deployType="j2:minDeploy" and recreateDB=true.
j2:nodbMinStart Invokes j2:doStart with deployType="j2:nodbMinDeploy" and recreateDB=false.

Deployment supporting Goals

Goal Description
j2:remove.wars Removes the portal, all standard and demo portlet applications (see j2:fullDeploy below) and their context descriptors (if any) from the Tomcat Server.
j2:catalina.base.shared Copies all base jars necessary for the common portlet container.
j2:catalina.shared Copies all jars necessary for common container
j2:copy.shared.deps Wrapper goal invoking j2:catalina.base.shared and j2:catalina.shared.
j2:portal.deploy Deploys the portal application only and its dependencies to the Tomcat Server, but no portlet applications.

First, it removes the current portal installation with goal j2:remove.wars.
Then it copies and expands the build portal war from the local maven repository to the application server.
And it copies a Tomcat context descriptor for the portal (see also goal j2:portal.conf.tomcat).
Finally, it installs the shared dependencies with goal j2:copy.shared.deps.

Standard and Demo Portlet Application deployment goals

Goal Description
j2:deploy Generic goal to deploy a portlet application identified by property ${maven.war.final.name}.

The portlet application is searched for in the Jetspeed2 group of the local maven repository. When searching portlets in the repository, this goal searches for the portlet application given the Jetspeed 2 version number configured in the plugin. The name of the file searched in the repository following the convention ${maven.war.final.name}-${jetspeed.version}.war and is deployed as ${maven.war.final.name}.war.
j2:pam.layoutdeploy Deploys Jetspeed local layout portlet application.
j2:pam.admindeploy Deploys Jetspeed Administration portlet application.
j2:pam.tsdeploy Deploys Pluto Test Suite portlet application.
j2:pam.strutsdeploy Deploys the struts mailreader demo portlet application.
j2:pam.jpetstoredeploy Deploys the iBatis JPetstore based demo portlet application.
j2:pam.jsfdeploy Deploys the JSF demo portlet application which uses Jetspeed generic JSF portlet bridge.
j2:pam.jsfmyfacesdeploy Deploys the JSF demo portlet application which uses MyFaces native JSF portlet bridge.
j2:pam.phpdeploy Deploys the Jetspeed PHP bridge demo portlet application.
j2:pam.perldeploy Deploys the Jetspeed Perl bridge demo portlet application.
j2:pam.rssdeploy Deploys the RSS feed demo portlet application.
j2:nodbMinDeploy Deploys the portal using the j2:portal.deploy goal and only the layout and admin portlets using j2:pam.layoutdeploy and j2:pam.admindeploy.
j2:minDeploy The same functionality as j2:nodbMinDeploy and additionaly seeds the portal database using the j2:db.entities goal.
j2:nodbfullDeploy The same functionality as j2:nodbMinDeploy but additional deploys all other demo portlet applications (see full list above).
j2:fullDeploy The same functionality as j2:nodbFullDeploy and additionaly seeds the portal database using the j2:db.entities goal.

Database Management Goals

Goal Description
j2:start.production.server Starts a HSQLDB production database for usage by the portal. This goal is optional to those who use the default embedded Derby database.
j2:start.test.server Starts a HSQLDB test database to be used for the testcases during the build of Jetspeed 2. This goal is optional for those who use the default embedded Derby database for testing Jetspeed 2.
j2:db.create.test Creates the test database tables. If using the HSQLDB database, it should be started first with goal j2:start.test.server.
Existing portal tables are dropped first. The first time, this will lead to "table does not exist" error messages but they can be (and are) ignored.
j2:db.create.production Creates the production database tables. If using the HSQLDB database, it should be started first with goal j2:start.production.server.
Existing portal tables are dropped first. The first time, this will lead to "table does not exist" kind of error messages but they can (and are) ignored.
j2:db.recreate Recreates the production database using the j2:db.create.production goal but first (re)generates the sql scripts using j2:portal.conf.sql.
j2:db.drop.test Drops the test database portal tables.
j2:db.drop.production Drops the production database portal tables.
j2:db.entities Populates the users information for the default PSML configuration configured with Jetspeed 2.

LDAP Management Goals

Goal Description
j2:start.ldap.server Starts the default Apache Directory Server and load the default apacheds-server.xml configuration.

Auxillary Jetspeed Components Deployment Goals

Generic set of goals for redeploying a specific Jetspeed component.

Goal Description
j2:jar.deploy Deploys a Jetspeed core component from the local maven repository to the deployment directory.
j2:jar.deploy.shared Deploys a Jetspeed core component shared library from the local maven repository to the Tomcat shared library directory.
j2:deployDecorations Deploys all decoration files from the WEB-INF/decorations directory to the deployed portal.
j2:deployTemplates Deploys all template files from the WEB-INF/templates directory to the deployed portal.