Note the Maven-1 plugin will be deprecated in Jetspeed version 2.2
We will not go into the specifics of Maven as that is beyond the scope of this document. If you have never used Maven, you need to read "What is Maven" just to get a sense of the role of Maven in a software development project. If your project involves more than one or two people, you may want to look into Maven in more detail since it does simplify and standardize many of the project management issues that are commonly encountered.
Here are a few bits of standard maven jargon we feel is important for you to know.
You will see mention of a
maven repository
in this document. When you install Maven the .maven/
directory is created in your ${USER_HOME) directory.
Under .maven/ you will see a
repository
directory. This is were Maven stores all of the jars
that it downloads when you run your builds. This is
also were Maven puts your jars and wars that you
build.
Jar files will be stored in a directory structure
that has the format of
${groupId}/${projectId}/jars/${projectId}-{$version}.jar.
The portal war file is stored as
${groupId}/${projectId}/wars/${projectId}.war. The
${groupId}, ${projectId} and ${version} variables
are discussed later on in this document. Jar and war
files will also be created in your project in the
/target
directory.
Variables are represented as ${ some_variable }. Variable names are case sensitive. Variables are defined in several places in a Maven project and according to the Maven Setup section of the on-line Maven User's Guide, the properties files in Maven are processed in the following order:
Maven processes this sequence of properties files, overriding any previously defined properties with newer definitions. The last definition wins! In this sequence, your ${user.home}/build.properties has the final say in the list of properties files processed.
This list of properties files that Maven processes is called the "standard properties file set".
In addition, System properties are processed after the standard properties files. So, a property specified on the command line using the -Dproperty=value convention will override any previous definition of that property.
For example, ${org.apache.jetspeed.server.home} references either:
The documentation refers to some common locations by the following names:
These are not used in the Jetspeed configuration but are merely shorthand notations to make the documentation more concise and precise.
Subversion (SVN) is used in the Jetspeed project to manage the source files. SVN is very similar to CVS. For those user's on Windows system who prefer non-command line access we suggest using TortoiseSVN which plugs into your Windows Explorer view. For those using the Eclipse IDE, the Subclipse plugin is available for SVN access.
Setting up a custom portal development project using the binary distribution is a fairly simple process. At the end, you will you have a directory structure and set of files that will simplify building and deploying your own custom portal.
If you want to setup a Jetspeed portal application using Eclipse as your IDE, you should continue reading this page for background material but refer to Building a Jetspeed Enterprise Portal with Eclipse for the actual instructions on using Eclipse for Jetspeed 2 portal development.
Creating your own custom portal is very easy with the maven plugin provided by Jetspeed 2. The steps are:
The Jetspeed 2 maven-plugin defines default values for most of the properties you can set, but not all. As you customize the portal, you will override others.
${USER_HOME}/build.properties
:
basedir = c:/myportal maven.repo.remote = http://www.bluesunrise.com/maven/, http://www.ibiblio.org/maven/, \ http://dist.codehaus.org/, http://cvs.apache.org/repository
The first time, and when you want to upgrade to a newer version of Jetspeed 2, you need to install the maven-plugin as follows:
maven -DartifactId=maven-jetspeed2-plugin -DgroupId=org.apache.portals.jetspeed-2 -Dversion=2.1.3 plugin:download
Once you have the maven-plugin installed and set properties as needed, generate a default portal configuration using the plugin as follows:
maven j2:portal.genapp
You can fill in as much of the project information in the project.xml file as you want. This will depend on how you intend to use Maven as a project management tool and is beyond the scope of this document. The information in the project.xml file distributed with Jetspeed reflects the Jetspeed development project.
You can now customize the properties files to reflect your database installation and local environment.
The
${basedir}project.properties
file provided by the Jetspeed developers includes
all of the variables that are common to all portals
based on Jetspeed. You should not have to change
these.
The project properties are described in the
Maven Properties Reference
documentation. We have already filled in the value
for basedir and maven.repo.remote in previous steps.
You can fill in as much of the project information
in the
${basedir}project.xml
file as you want. This will depend on how you intend
to use Maven as a project management tool and is
beyond the scope of this document. The
Maven site
has all of the information that you need to use
Maven successfully.
The configuration of your specific properties needs to be done before we can build the portal. Review the definition of the configuration properties described in Basic Configuration Parameters .
In the case of a binary build, the basic
configuration properties can be placed in
${basedir}build.properties
. A minimal custom portal configuration using the
default Derby database can be something like:
# required portal configuration properties org.apache.jetspeed.portal.home = /home/myportal/ org.apache.jetspeed.portal.groupId = myprojects org.apache.jetspeed.portal.artifactId = myportal org.apache.jetspeed.portal.name = My Test Portal org.apache.jetspeed.portal.currentVersion = 1.0
If you are not using the Derby database that comes
pre-configured in the
${basedir}project.properties
file, you also need to define the database
parameters in the
${basedir}build.properties
file. Refer to the
Database Configuration
section for a description of the variables required.
Verify that you made the Application Server changes suggested in the overview of the Getting Started documentation.
A minimal custom portal configuration using the Tomcat 5.5 Application Server could be something like:
# required portal configuration properties org.apache.jetspeed.portal.home = /home/myportal/ org.apache.jetspeed.portal.groupId = myprojects org.apache.jetspeed.portal.artifactId = myportal org.apache.jetspeed.portal.name = My Test Portal org.apache.jetspeed.portal.currentVersion = 1.0 # required application server properties org.apache.jetspeed.server.home = ${CATALINA_HOME}/ org.apache.jetspeed.server.shared = ${org.apache.jetspeed.server.home}/shared/lib/ org.apache.jetspeed.deploy.war.dir = ${org.apache.jetspeed.server.home}/webapps/ org.apache.jetspeed.services.autodeployment.user = j2deployer org.apache.jetspeed.services.autodeployment.password = xxxxx org.apache.jetspeed.catalina.version.major = 5.5
Once your portal configuration and setup is ready, you can build and install the portal application in your local maven repository (as needed for deployment) using the following standard maven goal from your custom portal project directory (in ${org.apache.jetspeed.portal.home}):
maven war:install
You are now ready to deploy the new portal application. For this, skip the following section on building the Jetspeed 2 portal from source and continue with the deployment section.
You need to make sure that your database server is running. If you are not using the default Derby database, you need to make sure that it is running and that the user that will own the Jetspeed tables is setup and ready for use. Refer to the Database Configuration section for more information.
You need to have this database running during the deployment and while running the application server.
Note: this is required when using the
j2:quickStart
goal as described below. The Jetspeed 2 maven-plugin
provides other (sub)goals which you can use without
(re)creating a production database and/or inserting
default portal configuration data. See the
Plugin documentation
for further information about the available goals.
The database's tables and initial data needs to be loaded prior to Jetspeed being deployed. The maven-plugin includes a number of goals that can be used to manage the database. The easiest way to load the tables and deploy the application is to run the j2:quickstart goal.
cd ${org.apache.jetspeed.portal.home} maven j2:quickStart
The j2:quickstart currently only covers deploying to Tomcat 5 or Tomcat 5.5 application servers.
Information about deployment to other application servers can be found at the The Jetspeed 2 Wiki .
To deploy a default Jetspeed 2 portal, including the demo portlet applications, run the following in a separate console:
cd ${org.apache.jetspeed.portal.home} maven j2:quickStart
The j2:quickstart task does this for you. If you have used another Maven goal to initialize the database, then you can deploy the portal by using:
cd ${org.apache.jetspeed.portal.home} maven j2:fullDeploy
The j2:fullDeploy goal currently only covers deploying to Tomcat 5 or Tomcat 5.5 application servers.
Information about deployment to other application servers can be found at the The Jetspeed 2 Wiki .
The final step in getting the default portal running is starting up your Tomcat server. The portal will automatically install any deployed portlet applications.
Then you can access the portal with your browser at:
or replace "jetspeed" in the above url with the name of your own portal application (
${org.apache.jetspeed.portal.artifactId}
).
If you see a running Jetspeed portal, we have succeeded in getting the software installed and working.
With the default Jetspeed 2 portal deployment, several example user accounts are inserted into the portal database with which you can logon to the portal:
username | password | roles |
---|---|---|
admin |
admin |
admin, manager, user |
manager |
manager |
manager, user |
jetspeed |
jetspeed |
manager |
user |
user |
user |
tomcat |
tomcat |
Now that the default portal is working we can try a small customization to test out the customization process. We are going to change the logo and portal name.
The first step is to create a directory to hold your customized files. This will help you to preserve your changes when you install new versions of jetspeed. Create a directory in the top level of the portal home.
cd ${org.apache.jetspeed.portal.home} mkdir customized
Make a copy of the build.properties file that you have already modified.
You may also want to make a directory to hold the original files before you modify them. This is not strictly requirred since you can always reload the distribution. However it might be handy to keep a copy for reference or to quickly get back to the state before you made changes.
We are going to change the logo and the portal
name to test customization. You can make you own
logo to replace the Jetspeed logo. Take a look
at the ${basedir}/src/webapp/images/logo.png to
get the size and to verify the background
colour. Make your own logo or copy the
testlogo.png file to your
${basedir}/customized
directory.
cd ${org.apache.jetspeed.portal.home} maven j2:fullDeploy
You can access the revised portal with your browser at:
http://localhost:8080/jetspeedor replace "jetspeed" in the above url with the name of your own portal application (
${org.apache.jetspeed.portal.artifactId}
).
You should see the new name and the new logo on the front page.