Building with Maven and the Jetspeed Plugin

To build Jetspeed and the tutorial, you must install Maven. Please download and install Maven before continuing. All the examples below will assume you are running from a command line in the /tutorial directory of the jetspeed distribution.

The Jetspeed Plugin is used manage building a portal site. We strongly recommend using the Jetspeed Plugin and Maven to build your portal site. We strongly recommend NOT editing any of the source files in the Jetspeed source tree unless you plan to contribute your changes back. The important point here is that for the health and maintainability of your portal, you should keep your source files and resources separate from Jetspeed. By doing so, you can manage your source code in your CVS, and let the community manage the core Jetspeed source code and resources. As new releases of Jetspeed come out, you will always be ready to integrate without having to figure out what changes you made to the core code.

The Jetspeed Plugin builds your portal by merging the content and source files from your portal project with a distribution of Jetspeed. Property files, portal resources, PSML, Java code are all merged into a new WAR file ready to be distributed to an application server. This tutorial will walk you through how to use the Plugin and Maven to build and maintain your portal.

The Jetspeed Plugin doesn't require many properties. You can set the properties in your home directory's build.properties or in your project's project.properties:


# Tell the Plugin which property files to merge maven.merge.properties = JetspeedResources,JetspeedSecurity,TurbineResources,Torque # tell the plugin which version of Jetspeed distribution we are merging with jetspeed.dist.version = 1.6

Here are the goals available in the tutorial project:


jetspeed:war Build all tutorials and create a distribution WAR file
clean Delete old build and dist directories
java:compile Compile Java sources
jetspeed:deploy Deploy application to servlet container
dist Create binary distribution
jetspeed:hotdeploy Hot Deploy application to portlet container
javadoc Create Javadoc API documentation
torque:om Generate Object Model sources
-Dtutorial=0 Resets the tutorials
tutorial-n [1-12] deploy Configure the distribution for the nth tutorial examples.

Note that for the jetspeed:deploy, jetspeed:hotdeploy, jetspeed:war goals, with the tutorial you can type short cuts: deploy, hotdeploy, war. The hotdeploy goal will be more useful in your own project and is not necessary in the step by step tutorial. To build the examples for a specific tutorial example, type:

maven -Dtutorial=[n] jetspeed:deploy   (where n = the number of the tutorial)

The tutorials can be run in any order. If you want to deploy tutorial-5, you don't have to run 1-4, 5 will automatically include 1-4.

Thats it. You are now ready to start up the JPortal web application. Start up Catalina and point a browser at:


http://localhost:8080/jportal/portal

You will see the Home Page for JPortal. To see JPortal customized for a user, logon to the system as:

Username = turbine

Password = turbine

NOTE: you should shutdown Catalina before invoking the deploy goal.

Development Cycle

During development of the tutorial examples, we will often deploy our portlets into a Jetspeed web application, a portlet container. This is accomplished with the maven goals provided with the tutorial. A Jetspeed portal is distributed as a Java standard WAR file. To creates the entire portal war file which you can manually copy to your application server, build the 'maven jetspeed:war' goal. The jetspeed:war goal is the default goal for the tutorial. This war file contains a combination of the Jetspeed distribution with your example code. The war file combines the Jetspeed core portal with the example portlets and their configuration. The war file is written to the file /target/jportal.war. The 'jetspeed:war' goal is the default goal, so just typing 'maven' will execute it:


maven

During the tutorial, we recommend using the jetspeed:deploy goal. NOTE: make sure to shutdown Tomcat or Catalina before running the jetspeed:deploy goal. To configure, build the war, and deploy the distribution to match the given tutorial, where [n] is the number of the tutorial from this document:


maven -Dtutorial=[n] deploy

The deploy goal is dependent on the jetspeed:war goal. After building the war file, it automatically deploys the war file into the application server of your choice. For this tutorial, Jakarta Tomcat 4 or 5 is required. NOTE: you should shutdown Catalina before invoking the deploy goal. You will need to setup the location of Tomcat in your build.properties in your home directory using the tomcat.root property.

maven jetspeed:hotdeploy

The jetspeed:hotdeploy goal is a quicker version of deploy. It only deploys classes and configuration files that are newer than the files in the deployed web application. Requires that deploy goal is ran once, since it will not expand the entire application to the web application directory. This goal is used most often in the everyday development routine. For the tutorial we do not use it. If you change any Java files, you will may have to recycle your application server to load the new class files.

If you would like to clean up the JPortal Tutorial examples and reset to a default Jetspeed deployment, type:

	maven clean

maven jetspeed:deploy

The clean maven goal removes all classes and configuration files from the deployment, leaving you with a web application that is exactly the same as the Jetspeed web application. No changes are made to the Jetspeed distribution. When you point your browser at http://localhost:8080/jportal/portal, you will see the default Jetspeed portal. This goal is useful if you want to restart the tutorials from the beginning.

Jetspeed 2.0 will support the Java Standard Portlet API, which defines a standard deployment descriptor and portlet archive for deploying portlets to portlet containers. Version 1.x of Jetspeed does not support the standard, thus a custom deployment procedure is necessary.