使用 Click 框架進行 Java Web 應用程式開發/構建
外觀
Click 使用基於 Ant 的構建系統來建立 JAR 檔案、應用程式 WAR 檔案和 Click 發行版。
Click Ant 構建系統的配置如下所示
--[build] Ant build directory | | | ---build.xml Ant build script | | | ---build.properties Ant build properties | --[dist] JAR and WAR file output directory | --[documentation] Click documentation set application | --[examples] Click Examples application | | | ---build.xml Ant build script | | | ---README.txt Click Examples Readme file | --[extras] Click Extras source directory | --[framework] Click framework source directory | --[lib] Dependent JAR libraries directory | --[mock] Mock objects source directory
在執行構建之前,請確保滿足以下要求
- 確保JAVA_HOME環境變數已設定並指向 JDK 安裝(1.4 或更高版本)。
- 確保ANT_HOME環境變數已設定並指向 Ant 安裝(1.7.0 或更高版本)。
- 確保junit.jar存在於您的ANT_HOME/lib目錄中。
ant help
Buildfile: build.xml
help:
[echo] Click web application framework
[echo] ===============================
[echo] Main targets:
[echo] build-all build framework, extras, examples
[echo] build-distribution build distribution ZIP file
[echo] build-examples build click-examples WAR file
[echo] build-extras build click-extras JAR file
[echo] build-framework build click framework JAR file
[echo] build-maven-bundles build Maven repository upload bundles
[echo] build-sources build source ZIP files for use with IDEs
[echo] deploy-examples copy examples WAR files to app server
[echo] get-deps download JAR dependencies
[echo] get-deps-proxy download JAR dependencies via proxy
[echo] help display the Help message
[echo] javadoc create Javadoc HTML files
[echo] Please ensure you have configured build.properties
BUILD SUCCESSFUL
執行 Ant 目標get-deps從 Ibiblio Maven 儲存庫下載 JAR 依賴項
- ant get-deps
如果您在防火牆後面,請使用 Ant 目標get-deps-proxy並在build.properties
# Proxy hostname used by Ant target 'get-deps-proxy'
proxy.host=192.168.0.3
# Proxy port for by Ant target 'get-deps-proxy'
proxy.port=3128
中配置您的代理設定
構建框架[編輯 | 編輯原始碼]要構建 Click 框架 JAR 檔案
- click.jarget-deps確保以上配置已完成,並且
- 執行 Ant 目標已執行。build-framework
- 來構建框架
ant build-framework
構建額外內容- click.jarget-deps確保以上配置已完成,並且
- click-extras.jar執行 Ant 目標framework和:
- build-extras
ant build-framework build-extras
構建示例- 要構建 Click 示例和 Click 快速入門 Web 應用程式 WAR 檔案請參閱examples/README.txt
- click.jarget-deps確保以上配置已完成,並且
- 執行 Ant 目標檔案,確保已配置必要的屬性並下載了依賴項。:
- build-all
框架依賴項
ant build-all| Click 框架具有以下執行時依賴項。 | 庫 | 版本 | JAR / 原始碼 | 作者 |
|---|---|---|---|---|
| 描述 | 1.4 | Java 執行時 | n/a | Sun Microsystems |
| J2SE 執行時環境 | 2.3 | Servlet API | n/a | servlet-2.3.jar |
| JEE Servlet API | 1.5 | Velocity 引擎 | velocity-1.5.jar* | Apache Velocity |
| Velocity 模板框架 | 1.1 | Velocity 工具 | WebappLoader 原始碼* | Jakarta Velocity 工具 |
| Velocity 工具實用程式庫 | 2.6.9 | OGNL | Velocity 工具實用程式庫 | ognl-2.6.9.jar * |
| 物件圖形導航庫 | 2.1 | 通用語言 | commons-lang-2.1.jar * | Jakarta Commons |
| 通用語言實用程式庫 | 1.2 | 通用檔案上傳 | commons-lang-2.1.jar * | commons-fileupload-1.2.jar * |
| HTTP 檔案上傳庫 | 1.3 | Commons Codec | commons-lang-2.1.jar * | commons-codec-1.3.jar * |
| 編碼解碼庫 | 3.1 | Commons Collections | commons-lang-2.1.jar * | commons-collections-3.1.jar * |
| 集合實用程式庫 | 1.1 | Common IO | commons-lang-2.1.jar * | commons-io-1.3.jar * |
| IO 實用程式庫 | 1.3.4 | 併發 | ConcurrentReaderHashMap 原始碼* | Doug Lea |
併發實用程式庫要構建 Click 框架 JAR 檔案*: 標記的庫和原始碼包含在
檔案中。標準click-xx.jar
包含所有列出的依賴項。或者,使用click-nodeps-xx.jar
額外依賴項
,它不包含任何這些依賴項。| Click 框架具有以下執行時依賴項。 | 庫 | 除了框架依賴項之外,Click 額外內容還具有以下執行時依賴項。 | JAR / 原始碼 | 作者 |
|---|---|---|---|---|
| JAR | 2.0.3 | Cayenne | cayenne-nodeps-2.0.3.jar | Apache Cayenne |
| ORM 框架 | 3.1.3 | Hibernate | ORM 框架 | Apache Cayenne |
| hibernate-3.1.3.jar | 1.2.14 | Log4J | log4j-1.2.14.jar | Log4j |
| 日誌記錄框架 | 1.2.9 | Spring | spring-1.2.9.jar | Spring 框架 |
| IoC 框架 | 1.0 | JSCalendar | JavaScript 原始碼* | Dynarch.com |
| JavaScript 日曆小部件 | 2.33 | JSCalendar | JSGraphics | Walter Zorn |
| JavaScript 圖形庫 | 1.5.0 | JSCalendar | Prototype | Prototype Org |
| JavaScript 庫 | 1.7.0 | JSCalendar | JavaScript 庫 | Prototype Org |
併發實用程式庫要構建 Click 框架 JAR 檔案*: 標記的庫和原始碼包含在