Essentials
Download
Get Involved
SubProjects
Misc
|
What is this?
|
The Jakarta-Site2 module is where we store the code for building our
static HTML website. We use XML files as our input and transform them
into static HTML files (which is what you are reading now). The reason
why we use static HTML is because the apache.org server gets a huge
number of "hits" each day. Having a dynamic site would increase the load
on the server to an even more unacceptable level because apache.org is
a limited resource shared by hundreds of people. Using XML as our input
allows us to change the look and feel of the entire site in a matter of
seconds.
Each Jakarta project has the choice of how they generate their website
and documentation. The "encouraged" way is to use the Jakarta-Site2
module as the basis for generating the documentation. The provides a
consistent look and feel for all of the Jakarta sites pages. As you
browse various projects, you may notice slight variations in the look of
the site. This is because other projects have chosen to use different
technologies for transforming their XML files and have not kept up with
the general look and feel of the main Jakarta Site. This is perfectly ok
with us as we allow our developers the freedom to innovate.
The jakarta-site2 module uses Anakia to do the XML->HTML
transformations. Therefore, it is highly recommended that you read the
Anakia documentation in order to get
an overview of what you are dealing with (it really is quite simple as
you will soon discover).
|
|
Using the jakarta-site2 module as a dependency
|
If you would like to use the jakarta-site2 module as a dependency for
your project, here are the instructions for how to do that. The benefit
of using it as a dependency is that you will be able to easily adopt the
look and feel of the entire Jakarta website while being able to continue
to have control over your own project's documentation navigation. It is
the recommended, but optional way to develop documentation for projects
hosted under the main Jakarta Project.
|
|
Doing it your way
|
For reasons of expediency, you might be tempted to do things in
your own way. Once you know HTML who needs Anakia, right? This is the
incorrect approach but we will explore it so that the basic steps for
updating your site on Jakarta become clearer.
Assuming your project is called myproject, here are steps
you should follow:
- Logon to the machine hosting the Jakarta web site.
- Create a directory named
myproject under the
/www/jakarta.apache.org/ directory.
- Copy your HTML files under the newly created directory.
- That's it!
The new project's web-pages should be accessible under
http://jakarta.apache.org/myproject .
The important point to remember is that you are responsible for
updating your project pages. This statement remains true even if
you switch to the recommended procedure described below.
If you decide to place your project's web pages under CVS control,
then the pages should pertain to your project's CVS module and
not to the jakarta-site2 module. For example, the
contents of /www/jakarta.apache.org/regexp/CVS/Repository
refer to jakarta-regexp/docs and in no way to the
jakarta-site2 module. Ask for help if you don't see what
we are talking about.
There are several problems with the do-it-your-way approach we have
just outlined. First, the myproject pages are not linked
to from the other Jakarta project pages. Your project is just
dangling off Jakarta. Second, your web-pages do not follow the same
look-and-feel as the other Jakarta projects. You can spend many hours
trying to imitate the same look and feel. However, the Jakarta
look-and-feel might change in the future. What will you do then? The
solution is described below. Read on.
|
|
How To: From the included example
|
The jakarta-site2 module has an /examples directory. Within there is
a jakarta-myproject directory that you can copy into your /projects
directory. This directory has everything that you need to get
started with the documentation portion of your project. Essentially,
it contains all of the files and configuration that is documented
below.
Once you have copied the directory into /projects, you should read
the instructions below to get a feeling for where everything is and
how things are configured.
|
|
How To: From Scratch
|
You should first create a directory structure within your project that
can be used to store your documentation:
|
|
|
|
/projects
/jakarta-myproject/
/build.sh <-- Your Ant build.sh file
/build.xml <-- Your Ant build.xml file
/docs/ <-- This is where the generated .html
files will go. Your images and other
resources will also end up in here.
/xdocs/ <-- This is where your source .xml files
will go.
/images/ <-- This is where your images will go.
/stylesheets/ <-- This is where your project.xml and
optionally, your style.vsl will go.
/project.xml <-- Your project.xml file. See below.
/velocity.properties <-- A copy of the velocity.properties
file. See below.
|
|
|
|
|
Copy the project.xml file from the jakarta-site2/xdocs/stylesheets/
directory into your jakarta-myproject/xdocs/stylesheets/ directory and
modify it as needed to reflect the navigation needs of your project. If
you are going to provide links to other projects within the Jakarta
project, make sure to make their href attribute based on the "document
root". For example, if your project links to the Ant project, then the
href should be something like this: href="/ant/index.html"
You will need to make a copy of the velocity.properties file from the
jakarta- site2 module. Place it into the xdocs directory as outlined
above. Within the file, you should modify the property shown below to
point to the stylesheets directory within the jakarta-site2 directory.
The path is relative to where the build.sh script is run from. This
tells Velocity where to look for the style.vsl file. Since you want the
same look and feel as the Jakarta website, you should at least start off
by using this file.
|
|
|
|
resource.loader.1.resource.path = ../jakarta-site2/xdocs/stylesheets
|
|
|
|
|
Assuming that you are using Ant as your
build tool for your project, you should then be able to copy/paste the
appropriate targets from the jakarta-site2/build.xml file into your own
build.xml file for your project. You will need to make sure that the jar
files in the jakarta-site2/lib directory are also added into your
classpath in your build.sh script. The reason is that Ant does not have
a way (that I know of) to add files to the classpath based on a
conditional set of requirements. In other words, you want to allow
people to build the rest of your project, but you do not want to require
your users to have the jakarta-site2 module checked out in order to do
so. You only want them to have to check out the jakarta-site2 module if
they are going to build their documentation. Unfortunately, this isn't
currently possible with Ant, therefore you need to specify the
jakarta-site2 .jar files in the build.sh classpath using the examples
below...
Below is the stuff you should add to your build.xml file. Please note
that the path to the docs.src and docs.dest would be relative to the
directory where the build.sh script is run from.
|
|
|
|
<property name="docs.src" value="./xdocs"/>
<property name="docs.dest" value="./docs"/>
<target name="prepare">
<available classname="org.apache.velocity.anakia.AnakiaTask"
property="AnakiaTask.present"/>
</target>
<target depends="prepare" name="prepare-error" unless="AnakiaTask.present">
<echo>
AnakiaTask is not present! Please check to make sure that
velocity.jar is in your classpath.
</echo>
</target>
<target name="docs" depends="prepare-error" if="AnakiaTask.present">
<taskdef name="anakia" classname="org.apache.velocity.anakia.AnakiaTask"/>
<anakia basedir="${docs.src}" destdir="${docs.dest}/"
extension=".html" style="./site.vsl"
projectFile="stylesheets/project.xml"
excludes="**/stylesheets/** empty.xml"
includes="**/*.xml"
lastModifiedCheck="true"
velocityPropertiesFile="${docs.src}/velocity.properties">
</anakia>
<copy todir="${docs.dest}/images" filtering="no">
<fileset dir="${docs.src}/images">
<include name="**/*.gif"/>
<include name="**/*.jpeg"/>
<include name="**/*.jpg"/>
</fileset>
</copy>
</target> |
|
|
|
|
Below is an example of what your build.sh file should look like. What is
important to note is that it is building up the CLASSPATH to find the
.jar files for Anakia. Because it adds itself to the CLASSPATH after you
do, any .jar files in your project that duplicate the .jar files needed
by Anakia will take precedence. So, if there are issues with running
Anakia with a combined classpath, you can opt to make a separate build
script for running Anakia with its own CLASSPATH.
|
|
|
|
#!/bin/sh
if [ "$JAVA_HOME" = "" ] ; then
echo You must set JAVA_HOME to point at your Java Development Kit directory
exit 1
fi
# convert the existing path to unix
if [ "$OSTYPE" = "cygwin32" ] || [ "$OSTYPE" = "cygwin" ] ; then
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# Add in your .jar files first
for i in ./lib/*.jar
do
CLASSPATH=$CLASSPATH:"$i"
done
# Add in the jakarta-site2 library files
for i in ../jakarta-site2/lib/*.jar
do
CLASSPATH=$CLASSPATH:"$i"
done
# convert the unix path to windows
if [ "$OSTYPE" = "cygwin32" ] || [ "$OSTYPE" = "cygwin" ] ; then
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
fi
BUILDFILE=build.xml
#echo $CLASSPATH
java $ANT_OPTS -classpath "$CLASSPATH" org.apache.tools.ant.Main \
-Dant.home=$ANT_HOME \
-buildfile ${BUILDFILE} \
"$@" |
|
|
|
|
|
|
Tag Documentation
|
The list of tags which you can use within your XML/XHTML file are
documented on another page.
|
|
Feedback
|
If there are parts of this document that are confusing to you or there
are errors in the Anakia portion of the jakarta-site2 module, please
send feedback to the general@jakarta.apache.org mailing list. Please try
to give a detailed description of what is confusing so that I can update
the page to make things more clear.
|
|
|