Sophie

Sophie

distrib > Mageia > 7 > armv7hl > by-pkgid > f0ae7119e7e8957b16c9c179b834e5b1 > files > 671

velocity-manual-1.7-22.mga7.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<!--
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership.  The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License.  You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing,
 software distributed under the License is distributed on an
 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.    
-->

<!-- start the processing -->
    <!-- ====================================================================== -->
    <!-- GENERATED FILE, DO NOT EDIT, EDIT THE XML FILE IN xdocs INSTEAD! -->
    <!-- Main Page Section -->
    <!-- ====================================================================== -->
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>

                                                    <meta name="author" value="Velocity Documentation Team">
            <meta name="email" value="dev@velocity.apache.org">
            
           
                                    
                        
            <title>Velocity - Building Velocity from Source</title>

									<link rel="stylesheet" href="./site.css" type="text/css">
        </head>

        <body>

			
			<div id="container">

				<div id="header">
					
<div id="logo1">
	<a href="http://velocity.apache.org"><img src="./images/velocity_project_wide.png" border="0"/></a>
</div>



<div id="logo2">

<a href="http://velocity.apache.org/"><img src="./images/velocity-logo.png" alt="Velocity" border="0"/></a>

</div>

				</div>

				<div id="menu">
					
    <!-- ============================================================ -->

            	<div class="menusection">
    		<span class="menuheader">Velocity</span>
			<ul>
							<li>    <a href="./index.html">General</a>
</li>
							<li>    <a href="./overview.html">Overview</a>
</li>
							<li>    <a href="./getting-started.html">Getting Started</a>
</li>
							<li>    <a href="./webapps.html">Web Applications</a>
</li>
							<li>    <a href="http://velocity.apache.org/download.cgi">Download</a>
</li>
							<li>    <a href="http://wiki.apache.org/velocity/VelocityFAQ">FAQ (Wiki)</a>
</li>
						</ul>
        </div>
        	<div class="menusection">
    		<span class="menuheader">Docs</span>
			<ul>
							<li>    <a href="./user-guide.html">User Guide</a>
</li>
							<li>    <a href="./developer-guide.html">Developer Guide</a>
</li>
							<li>    <a href="./vtl-reference-guide.html">VTL Reference</a>
</li>
							<li>    <a href="./glossary.html">Glossary</a>
</li>
						</ul>
        </div>
        	<div class="menusection">
    		<span class="menuheader">Developers</span>
			<ul>
							<li>    <a href="./../LICENSE">License</a>
</li>
							<li>    <a href="./api/index.html">Javadoc</a>
</li>
							<li>    <a href="http://velocity.apache.org/engine/devel/changes-report.html">Changes</a>
</li>
							<li>    <a href="http://velocity.apache.org/engine/devel/jira-report.html">Resolved Issues</a>
</li>
							<li>    <a href="./jar-dependencies.html">Dependencies</a>
</li>
							<li>    <a href="http://svn.apache.org/viewvc/velocity/engine/trunk/">Source Code Repository</a>
</li>
							<li>    <a href="./build.html">Building from Source</a>
</li>
						</ul>
        </div>
        	<div class="menusection">
    		<span class="menuheader">Community</span>
			<ul>
							<li>    <a href="http://wiki.apache.org/velocity/">Wiki</a>
</li>
							<li>    <a href="http://velocity.apache.org/news.html">Recent News</a>
</li>
							<li>    <a href="http://wiki.apache.org/velocity/PoweredByVelocity">Powered By Velocity</a>
</li>
							<li>    <a href="http://wiki.apache.org/velocity/VelocityEditors">IDE/Editor Plugins</a>
</li>
							<li>    <a href="http://wiki.apache.org/velocity/PublishedArticlesAndBooks">Articles and Books</a>
</li>
							<li>    <a href="http://wiki.apache.org/velocity/GetInvolved">Get Involved</a>
</li>
							<li>    <a href="http://velocity.apache.org/contact.html">Mailing Lists</a>
</li>
						</ul>
        </div>
        	<div class="menusection">
    		<span class="menuheader">Velocity Development</span>
			<ul>
							<li>    <a href="http://wiki.apache.org/velocity/RoadMap">Road Map</a>
</li>
							<li>    <a href="http://wiki.apache.org/velocity/CodeStandards">Coding Standards</a>
</li>
							<li>    <a href="http://wiki.apache.org/velocity/DocumentationGuidelines">Documentation Guidelines</a>
</li>
							<li>    <a href="https://issues.apache.org/jira/browse/VELOCITY">Issues</a>
</li>
							<li>    <a href="http://velocity.apache.org/who-we-are.html">Who we are</a>
</li>
						</ul>
        </div>
        	<div class="menusection">
    		<span class="menuheader">Translations</span>
			<ul>
							<li>    <a href="http://www.jajakarta.org/velocity/">Site (Japanese)</a>
</li>
							<li>    <a href="./translations/user-guide_fi.html">User's Guide (Finnish)</a>
</li>
							<li>    <a href="./translations/user-guide_fr.html">User's Guide (French)</a>
</li>
							<li>    <a href="./translations/user-guide_es.html">User's Guide (Spanish)</a>
</li>
						</ul>
        </div>
    				</div>

				<div id="body">
																	<a name="Installation"></a>
	<h1>Installation</h1>

	<div class="subsection">
														<p>
Velocity runs on a variety of platforms that have installed the Java 2
Virtual Machine. The J2SDK is required for users who want to compile
Velocity from its source code.
</p>
																			<p>
Everything required to build Velocity comes with the distribution, which
can be obtained from <a href="http://www.apache.org/dev/version-control.html">Subversion</a> or
from the <a href="http://vc.apache.org/snapshots/velocity/">nightly
snapshots</a>.  However, you will need to install Ant to build the Velocity sources.</p>
																			<p>Ant is also an Apache project, and can be
found <a href="http://ant.apache.org/">here</a>. To build Apache Velocity, you need at least Version 1.7 of Apache Ant.
</p>
																			<p>
The directory tree of the distribution looks like:
</p>
																			<div class="source">
build/      This is where the build scripts live.
convert/    The WebMacro to Apache Velocity conversion program.
docs/       Velocity Documentation in HTML format.
docs/api/   Velocity Javadocs.
examples/   Examples how to use Velocity.
lib/        Dependencies for building and using Velocity.
lib/test/   Dependencies needed for the various unit tests.
src/        This is where all of the source code is located.
test/       Contains test files needed for the unit tests.
xdocs/      Here are the .xml files for building the .html files
            related to the website and documentation. The files
            located in docs/ have been built from these sources.
</pre></div>
								</div>
												<a name="Required Tools"></a>
	<h1>Required Tools</h1>

	<div class="subsection">
														<p>
To make building Velocity easy and consistent, we require an Apache project
called <a href="http://ant.apache.org/">Ant</a> version 1.7 or
higher to perform the build process. We assume that you have followed
Ant's installation instructions and have it properly installed.
</p>
																			<p>
Velocity requires JDK 1.4 or greater to compile.  It's possible to use JDK 1.3 
to compile but several useful features will not be included.  Velocity requires 
a minimum of JDK 1.3 to run.
</p>
																			<p>
Finally, if you wish to modify Velocity's grammar you will need to a tool
called <a href="http://javacc.dev.java.net">JavaCC</a>.  We recommend 
version 3.2 or greater (for compatibility with JDK 1.5 syntax changes).
</p>
								</div>
												<a name="Jar Dependencies"></a>
	<h1>Jar Dependencies</h1>

	<div class="subsection">
														<p>Velocity requires various third party jar files for compiling and
for running.  Not all jar files are required in all cases.  When
building, all dependencies will be downloaded automatically. You can
control the download with the <code>skip.jar.loading</code> and
<code>force.jar.loading</code> properties in the
<code>build.properties</code> file.
</p>
																			<table>
                        <tr>
                        <th colspan="" rowspan="">
						Jar
			</th>
                                <th colspan="" rowspan="">
						Purpose
			</th>
                                <th colspan="" rowspan="">
						Required at Runtime?
			</th>
            </tr>
                                <tr>
                        <td colspan="" rowspan="">
											<code>antlr-2.7.5.jar</code>
					</td>
                                <td colspan="" rowspan="">
						XML parsing (XPath queries in particular)
			</td>
                                <td colspan="" rowspan="">
						Only for Anakia
			</td>
            </tr>
                                <tr>
                        <td colspan="" rowspan="">
											<code>avalon-logkit-2.1.jar</code>
					</td>
                                <td colspan="" rowspan="">
						Possible means of logging
			</td>
                                <td colspan="" rowspan="">
						No
			</td>
            </tr>
                                <tr>
                        <td colspan="" rowspan="">
											<code>commons-collection-3.1.jar</code>
					</td>
                                <td colspan="" rowspan="">
						Used in parsing configuration
			</td>
                                <td colspan="" rowspan="">
						Yes
			</td>
            </tr>
                                <tr>
                        <td colspan="" rowspan="">
											<code>commons-lang-2.1.jar</code>
					</td>
                                <td colspan="" rowspan="">
						Various String utility functions
			</td>
                                <td colspan="" rowspan="">
						Yes
			</td>
            </tr>
                                <tr>
                        <td colspan="" rowspan="">
											<code>commons-logging-1.1.jar</code>
					</td>
                                <td colspan="" rowspan="">
						To redirect log output to commons-logging
			</td>
                                <td colspan="" rowspan="">
						Only for those using commons-logging
			</td>
            </tr>
                                <tr>
                        <td colspan="" rowspan="">
											<code>jdom-1.0.jar</code>
					</td>
                                <td colspan="" rowspan="">
						XML parsing
			</td>
                                <td colspan="" rowspan="">
						Only for Anakia
			</td>
            </tr>
                                <tr>
                        <td colspan="" rowspan="">
											<code>log4j.1.2.12.jar</code>
					</td>
                                <td colspan="" rowspan="">
						Possible means of logging
			</td>
                                <td colspan="" rowspan="">
						No
			</td>
            </tr>
                                <tr>
                        <td colspan="" rowspan="">
											<code>oro-2.0.8.jar</code>
					</td>
                                <td colspan="" rowspan="">
						For regular expression parsing in tests and event handlers
			</td>
                                <td colspan="" rowspan="">
						Only for reference escaping event handlers
			</td>
            </tr>
                                <tr>
                        <td colspan="" rowspan="">
											<code>servletapi-2.3.jar</code>
					</td>
                                <td colspan="" rowspan="">
						For the deprecated VelocityServlet and redirecting log output to the servlet log.
			</td>
                                <td colspan="" rowspan="">
						Only for VelocityServlet or ServletLogChute
			</td>
            </tr>
                                <tr>
                        <td colspan="" rowspan="">
											<code>werken-xpath-0.9.4.jar</code>
					</td>
                                <td colspan="" rowspan="">
						XML parsing
			</td>
                                <td colspan="" rowspan="">
						Only for Anakia
			</td>
            </tr>
                                <tr>
                        <td colspan="" rowspan="">
											<code>junit-3.8.1.jar</code>
					</td>
                                <td colspan="" rowspan="">
						For running unit tests
			</td>
                                <td colspan="" rowspan="">
						No
			</td>
            </tr>
                                <tr>
                        <td colspan="" rowspan="">
											<code>hsqldb-1.7.1.jar</code>
					</td>
                                <td colspan="" rowspan="">
						For running database related unit tests
			</td>
                                <td colspan="" rowspan="">
						No
			</td>
            </tr>
                                <tr>
                        <td colspan="" rowspan="">
											<code>ant.jar</code>
					</td>
                                <td colspan="" rowspan="">
						Required for compilation. Provided by the ant build tool.
			</td>
                                <td colspan="" rowspan="">
						No
			</td>
            </tr>
            </table>
																			<p>
Note that you can always create a jar with all required run-time dependencies by executing the 
<code>jar-dep</code> task.
</p>
								</div>
												<a name="Building"></a>
	<h1>Building</h1>

	<div class="subsection">
														<p>
In each case below, it is assumed that you were successful in getting
the distribution from Subversion or as a nightly build, and with the latter,
were successful in unpacking.  Also, it is assumed that you are starting
in the 'velocity' directory, the root of the distribution tree.
All directory references will be relative to 'velocity'.
</p>
																			<p>
Change to the <b>build</b> directory (<code>cd
build</code>). Then, to build the jar file, simply type:
</p>
																			<div class="source">
ant
</pre></div>
																			<p>
Executing this script will create a <b>bin</b> directory
within the Velocity distribution directory. The <b>bin</b>
directory will contain the compiled class files (inside a
<b>classes</b> directory) as well as a
<b>velocity-XX.jar</b> file, where XX is the current
version number. Be sure to update your classpath to include Velocity's
<b>.jar</b> file.
</p>
																			<p>
Note that to build any of the specific build targets simply add
the target name to the command line.  For example, to build the Javadoc
API documentation:
</p>
																			<div class="source">
ant javadocs
</pre></div>
																			<p>Some of the most useful targets are:
</p>
																			<ul>
			<li>
						
    
													<b><code>jar</code></b>
										 builds the complete Velocity jar in the
    
													<code>bin</code>
										 directory.  This jar will be called 'velocity-X.jar',
    where 'X' is the current version number. This jar does not include
    necessary dependencies for Velocity.  If you use this
    target, you must put the required dependent jars in your CLASSPATH (or WEB-INF/lib).
    For convenience, you can use the 
													<code>jar-dep</code>
										 target to build
    a jar with all required dependent classes included.
  
			</li>
			<li>
						
    
													<b><code>jar-dep</code></b>
										 builds the complete Velocity jar in
    the 
													<code>bin</code>
										 directory.
   
			</li>
			<li>
						
    
													<b><code>clean</code></b>
										 deletes all generated classes, jars, documentation, and other files.
   
			</li>
			<li>
						
    
													<b><code>real-clean</code></b>
										 like 
													<code>clean</code>
										 but also deletes all downloaded jars.
   
			</li>
			<li>
						
    
													<b><code>docs</code></b>
										 builds these docs in the 
													<code>docs</code>
										 directory
    using Velocity's 
													<a href="anakia.html">Anakia</a>
										 XML transformation tool.
    Allows you to use
    Velocity templates in place of stylesheets
    - give it a try!
  
			</li>
			<li>
						
    
													<b><code>examples</code></b>
										 builds the example code in the example programs
    found in the 
													<code>examples</code>
										 directory. 
  
			</li>
			<li>
						
    
													<b><code>jar-src</code></b>
										 bundles all the Velocity source code into a single
    jar, placed in the 
													<code>bin</code>
										 directory.
  
			</li>
			<li>
						
    
													<b><code>javadocs</code></b>
										 builds the Javadoc class documentation in the
    
													<code>docs/api</code>
										 directory
  
			</li>
			<li>
						
    
													<b><code>package</code></b>
										 will generate the complete Velocity distribution package.
  
			</li>
			<li>
						
    
													<b><code>parser</code></b>
										 will compile the JavaCC parser files from src/Parser.jjt into
    the appropriate Java source files.  Requires JavaCC 3.2+ to be installed, and the
    property 
													<code>javacc.home</code>
										 to contain a path to the installed JavaCC directory.
  
			</li>
			<li>
						
    
													<b><code>test</code></b>
										 (after jar) will test Velocity against its testbed
    suite of test routines.
  
			</li>
	</ul>
																			<p>
Velocity should build 'out of the box', independent of your classpath.
If you get an error building Velocity, try a different nightly build (as
sometimes we make a mistake and the Subversion at the time of the nightly
snapshot isn't complete) or refresh from Subversion (you might have gotten a
Subversion snapshot while a developer was checking things in.)
</p>
																			<p>
If the problems persist, do not hesitate to ask the Velocity community
via our mail lists. They can be found <a href="http://velocity.apache.org/contact.html">here</a>. 
</p>
								</div>
												<a name="Testing Your Installation"></a>
	<h1>Testing Your Installation</h1>

	<div class="subsection">
														<p>
The Velocity developers use an automated test facility, and it is
included in the distribution. You can use it to make sure that all is
well with your build of Velocity.
</p>
																			<p>
To run the test suite, simply use the build target
<b>test</b> when you build:
</p>
																			<div class="source">
ant test
</pre></div>
																			<p>
If all is well, you should see output similar to:
</p>
																			<div class="source">
test:
    [mkdir] Created dir: ..../bin/test-reports
    [junit] Running org.apache.velocity.io.UnicodeInputStreamTestCase
    [junit] Tests run: 8, Failures: 0, Errors: 0, Time elapsed: 0.011 sec
    [junit] Running org.apache.velocity.test.AbsoluteFileResourceLoaderTestCase
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.015 sec
    [junit] Running org.apache.velocity.test.ArithmeticTestCase
    [junit] Tests run: 7, Failures: 0, Errors: 0, Time elapsed: 0.006 sec
    [junit] Running org.apache.velocity.test.BuiltInEventHandlerTestCase

...

BUILD SUCCESSFUL
Total time: 42 seconds

</pre></div>
																			<p>
Note that the number of tests may vary from those shown above, but if
you see 'OK' after the tests are run, all is well.
</p>
								</div>
									</div>

				<div id="footer">
					Copyright &#169; 1999-2007, <a href="http://www.apache.org/">The Apache Software Foundation</a>.
				</div>

			</div>

        </body>
    </html>
<!-- end the processing -->