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/资源 文件夹。 Tapestry 页面类在“Pages”文件夹下有其相关资源,Tapestry 组件类在 Components 文件夹下有其相关资源。这些资源被打包到 WEB-INF/类 WAR 文件夹。

  • 上下文资源 : 它们是 Web 应用程序的静态资源,如图像、样式表和 JavaScript 库 / 模块。它们通常放在 /src/main/webapp 下 文件夹,它们被称为 上下文资源 .此外,Web 应用程序描述文件(Java Servlet)web.xml 位于 WEB-INF 上下文资源文件夹。

  • 测试代码 : 这些是用于测试应用程序的可选文件,放在 源/测试/java and 源/测试/ 资源文件夹。它们没有打包到 WAR 中。