Apache Tapestry - 專案佈局



這是由Maven 快速入門 CLI建立的原始碼的佈局。此外,這也是標準 Tapestry 應用程式的建議佈局。

├── build.gradle 
├── gradle 
│   └── wrapper 
│       ├── gradle-wrapper.jar 
│       └── gradle-wrapper.properties 
├── gradlew 
├── gradlew.bat 
├── pom.xml 
├── src 
│   ├── main 
│   │   ├── java 
│   │   │   └── com 
│   │   │       └── example 
│   │   │           └── MyFirstApplication 
│   │   │               ├── components 
│   │   │               ├── data 
│   │   │               ├── entities 
│   │   │               ├── pages 
│   │   │               └── services 
│   │   ├── resources 
│   │   │   ├── com 
│   │   │   │   └── example 
│   │   │   │       └── MyFirstApplication 
│   │   │   │           ├── components 
│   │   │   │           ├── logback.xml 
│   │   │   │           └── pages 
│   │   │   │               └── Index.properties  
│   │   │   ├── hibernate.cfg.xml 
│   │   │   └── log4j.properties
│   │   └── webapp 
│   │       ├── favicon.ico 
│   │       ├── images 
│   │       │   └── tapestry.png 
│   │       ├── mybootstrap 
│   │       │   ├── css 
│   │       │   │   ├── bootstrap.css 
│   │       │   │   └── bootstrap-theme.css 
│   │       │   ├── fonts 
│                   ├── glyphicons-halflings-regular.eot 
│   │       │   │   ├── glyphicons-halflings-regular.svg 
│   │       │   │   ├── glyphicons-halflings-regular.ttf 
│   │       │   │   ├── glyphicons-halflings-regular.woff 
│   │       │   │   └── glyphicons-halflings-regular.woff2 
│   │       │   └── js 
│   │       └── WEB-INF 
│   │           ├── app.properties 
│   │           └── web.xml 
│   ├── site 
│   │   ├── apt 
│   │   │   └── index.apt 
│   │   └── site.xml 
│   └── test 
│       ├── conf 
│       │   ├── testng.xml 
│       │   └── webdefault.xml 
│       ├── java 
│       │   └── PLACEHOLDER 
│       └── resources 
│           └── PLACEHOLDER 
└── target     
   ├── classes     
   │   ├── com  
   │   │   └── example
   │   │       └── MyFirstApplication     
   │   │           ├── components     
   │   │           ├── data     
   │   │           ├── entities     
   │   │           ├── logback.xml     
   │   │           ├── pages 
   │   │           │   └── Index.properties 
   │   │           └── services     
   │   ├── hibernate.cfg.xml 
   │   └── log4j.properties     
   ├── m2e-wtp 
   │   └── web-resources 
   │       └── META-INF     
   │           ├── MANIFEST.MF 
   │           └── maven 
   │               └── com.example 
   │                   └──MyFirstApplication     
   │                     ├── pom.properties 
   │                       └── pom.xml     
   ├── test-classes 
   │   └── PLACEHOLDER 
   └── work         
      ├── jsp         
      ├── sampleapp.properties 
      └── sampleapp.script

預設佈局類似於WAR 內部檔案格式。使用 WAR 格式有助於在不打包和部署的情況下執行應用程式。此佈局只是一個建議,但如果應用程式在部署時打包成正確的 WAR 格式,則可以以任何格式進行安排。

原始碼可以分為以下四個主要部分。

  • Java 程式碼 - 所有 Java 原始碼都放在/src/main/java資料夾下。Tapestry 頁面類放在“Pages”資料夾下,Tapestry 元件類放在 components 資料夾下。Tapestry 服務類放在 services 資料夾下。

  • 類路徑資源 - 在 Tapestry 中,大多數類都有關聯的資源(XML 模板、JavaScript 檔案等)。這些資源位於/src/main/resources資料夾下。Tapestry 頁面類在其關聯的資源位於“Pages”資料夾下,Tapestry 元件類在其關聯的資源位於 Components 資料夾下。這些資源打包到 WAR 的WEB-INF/classes資料夾中。

  • 上下文資源 - 它們是 Web 應用程式的靜態資源,例如影像、樣式表和 JavaScript 庫/模組。它們通常放在/src/main/webapp資料夾下,稱為上下文資源。此外,Web 應用程式描述檔案(Java Servlet),web.xml 放在上下文資源的WEB-INF資料夾下。

  • 測試程式碼 - 這些是用於測試應用程式的可選檔案,並放在src/test/javasrc/test/Resources 資料夾下。它們不會打包到 WAR 中。

廣告

© . All rights reserved.