所以它使用许多 实用工具。不论是支持表达式,还是登记对象,还是创建漂亮的用户界面组件,Tapestry 都依赖第三方库让 Web 开发对于开发人员尽可能容易。
幸运的是,Tapestry 会自己进行大多数依赖项的下载和安装工作。唯一的麻烦就是跟踪这些额外的JAR 文件,但是正如在这一节中会看到的,这不是个大问题。
因为 Tapestry 用 HiveMind 来确定和下载依赖项,所以第一步是让 Tapestry 知道 HiveMind 文件在哪儿。请转到 Tapestry 目录 —— 可能是 /usr/local/java/tapestry-4.0-beta-12 —— 然后进入 config 目录。应当看到一个 build.properties 文件。打开它的时候,会看到类似清单 1的内容。在这里列出了 Tapestry的几个核心库和依赖项,以及它们的位置。这个列表并不反映 Tapestry 需要的全部依赖项,但是反映了编译基本的Tapestry 应用程序需要的依赖项集合。
清单 1. 默认的Tapestry build.properties 文件
# Copyright 2005 The Apache Software Foundation
#
# Licensed 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.
jboss.dir = c:/Work/jboss-3.0.6
jython.dir = c:/Work/Jython21
jetty.dir = c:/Work/Jetty-4.2.22
tomcat.dir = C:/Program Files/Apache Group/Tomcat 4.1
hivebuild.dir=c:/workspace/jakarta-hivemind/hivebuild
clover.dir=c:/Work/clover-1.0
jboss.dir=C:/jboss-4.0.2
如果这些项目和分配给它们的位置看起来比较怪,那就对了。实际上应当清除掉属性文件中的全部内容,除了以 hivebuild.dir和tomcat.dir 开始的之外,因为这些依赖项应当已经就绪。请修改这些依赖项的位置,使其与 HiveMind和Tomcat的安装位置匹配,build.properties的最终版本看起来应当像清单 2 这样:
清单 2. 修改后的build.properties 文件
# Copyright 2005 The Apache Software Foundation
#
# Licensed 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.
tomcat.dir=/usr/local/java/jakarta-tomcat-5.5.9
hivebuild.dir=c:/workspace/jakarta-hivemind/hivebuild
保存这个文件,并返回 Tapestry的根目录,设置 Ant。
了解Tapestry,第1部分 - 启动Tapestry并在Java环境中运行(4)
时间:2011-01-31 |