Java EE 7 教程 第一部分 简介 第2章 使用教程示例 第2.6节 教程示例目录结构

原文:http://docs.oracle.com/javaee/7/tutorial/doc/usingexamples006.htm
翻译:石卓林 shizhuolin@hotmail.com

2.6 Tutorial Example Directory Structure

To facilitate iterative development and keep application source files separate from compiled files, the tutorial examples use the Maven application directory structure.

Each application module has the following structure:

  • pom.xml: Maven build file
  • src/main/java: Java source files for the module
  • src/main/resources: configuration files for the module, with the exception of web applications
  • src/main/webapp: web pages, style sheets, tag files, and images (web applications only)
  • src/main/webapp/WEB-INF: configuration files for web applications (web applications only)

When an example has multiple application modules packaged into an EAR file, its submodule directories use the following naming conventions:

  • example-name-app-client: application clients
  • example-name-ejb: enterprise bean JAR files
  • example-name-war: web applications
  • example-name-ear: enterprise applications
  • example-name-common: library JAR containing components, classes, and files used by other modules

The Maven build files (pom.xml) distributed with the examples contain goals to compile and assemble the application into the target directory and deploy the archive to GlassFish Server.

2.6 教学示例目录结构

为了便于重复开发和保持应用程序源文件与编译后文件的分隔, 本教程使用Maven应用程序目录结构.

每个应用程序模块都拥有以下结构:

  • pom.xml: Maven 构建文件
  • src/main/java: 此模块的Java源文件
  • src/main/resources: 此模块的配置文件(WEB应用程序除外)
  • src/main/webapp: 网页, 网页风格, 标记文件和图像(仅web应用程序)
  • src/main/webapp/WEB-INF: WEB应用程序配置文件(仅WEB应用程序)

当某示例有多个应用程序模块被打包进一个EAR文件时, 其子模块目录使用下述命名预定:

  • example-name-app-client: 应用程序客户端
  • example-name-ejb: 企业bean JAR 文件
  • example-name-war: web应用程序
  • example-name-ear: 企业应用程序
  • example-name-common: JAR库包含组件, 类, 以及其他模块文件

Maven构建文件(POM.xml)作为样例开发配置,其包括目标编译,装配应用到目标目录,部署应用到glassfish服务器.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.

Proudly powered by WordPress   Premium Style Theme by www.gopiplus.com