- 浏览: 376493 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
ytlviv:
利器深藏之而不用,非常时方现光芒
[JMX一步步来] 4、动态MBean:DynamicMBean -
fantaxy025025:
总结的不错!搜藏了。原有的链接里面内容css有问题。辛苦楼主! ...
[JMX一步步来] 1、JMX的Hello World(转) -
xuyb_0314:
非常不错~~
查看ORACLE表空间使用情况的SQL语句 -
elan1986:
谢谢 在你这里找到了
在winxp下使用bat文件运行java程序而不弹出dos窗口 -
lqw8668:
...
XP SP2下安装Rose 出现 “MEM_BAD_POINTER”错误的解决方法
This document contains recommended conventions for structuring applications developed using Java 2 Platform, Enterprise Edition (J2EE platform) technology (hereafter referred to as J2EE applications). The J2EE 1.4 Specification (which can be downloaded from http://java.sun.com/j2ee/1.4/download.html#platformspec ) indicates that certain files, such as deployment descriptors, class files, interface files, and other files, must be present as part of an application. However, this specification does not specify a recommended or required directory structure for these files. The guidelines in this document are intended to assist developers with organizing the files and directories associated with an application in a logical fashion. Organizing your applications as shown in these guidelines will make it easier to manage and maintain a project, especially when multiple developers contribute to the same project or projects are maintained during an extended lifetime. Having a predefined, consistent, standard workspace layout saves time, especially at the onset of a project.
Following these conventions will help developers establish an overall directory structure for applications. The conventions suggest where to place different types of files generally present in an application, such as ant files, test files, compiled code, Java and non-Java source code files, portable and application server-specific deployment descriptors, utility code, binary libraries, documentation files, configuration files, Enterprise Application archive (EAR) files, Web Application archive (WAR) files, copyright and license documents, etc. They also help developers determine how to best separate project files from files that are distributed as part of an application download.
Following these conventions will also help developers package J2EE
applications into EAR or WAR files because consistent project structure
is helpful for proper packaging using common ant
targets.
These conventions, which the Java BluePrints team has followed with its applications (which can be accessed from http://java.sun.com/blueprints/code/index.html
), assume that developers use the Ant
tool for building projects. Developers using other build tools may have to make slight modifications to the conventions.
The guidelines and conventions discussed in this document include the following types of projects:
- J2EE applications containing a combination of Web and Enterprise JavaBeans (EJB) components that are packaged as EAR files. The conventions for J2EE applications are discussed more in Strategy for J2EE Applications .
- Web applications containing only Web components that are packaged as WAR files but not packaged into EAR files. The conventions for Web applications are discussed more in Strategy for Web Applications .
- Reusable J2EE components that are used by external projects and applications. Conventions for reusable J2EE components are discussed more in Strategy for Reusable J2EE Components and Modules .
The following figure shows the recommended structure for projects created with J2EE technology (J2EE projects) that contain one or more applications.
|
The directories and their contents as shown in Figure 1.1: J2EE Applications: Recommended Directory Structure are explained in Table 1.1: J2EE Applications: Recommended Directory Contents .
Table 1.1 : J2EE Applications: Recommended Directory Contents
apps/
|
|
build/
|
|
components/
|
|
conf/
|
META-INF
directory. Also includes configuration files that may require processing prior to being placed in the final module. |
dist/
|
ant
dist
task, structures under this directory represent the
unzipped versions of the binary created by the project. |
docs/
|
|
lib/
|
ant
targets that download the correct versions of dependent binaries at build time. |
web/
|
|
setup/
|
ant
files containing shared ant
tasks, or any other files that are used to configure a container for a project or application. |
web/WEB-INF/
|
web.xml
deployment descriptor and static configuration files such as faces-config.xml
. May also include vendor-specific runtime deployment descriptors, such as sun-web.xml
.
Generally, this directory contains files that are copied rather than
changed during a build. Dynamic configuration files should be placed in
the conf/
directory. |
test/
|
test/
directory contains project-wide tests. Each individual component or
module should also include a unit test, which should be placed in the src/test
directory for each component or module. |
Specific files recommended for J2EE applications are shown in Figure 1.1: J2EE Applications: Recommended Directory Structure and are described in Table 1.2: Function of Recommended Files .
Table 1.2 : Function of Recommended Files
Refer to the Java Adventure Builder Reference application at http://java.sun.com/blueprints/code/index.html#java_adventure for an example that applies this directory structure to an application.
These conventions do not cover all possible
directories, files, or artifacts that might be part of a project. In
particular, optional files are not covered. For example, a project
might rely on a setup.xml
file, which is an ant
file that sets up Java Naming and Directory Interface (J.N.D.I.) API
references, databases, database pools, or other resources needed to
deploy the project.
Some artifacts may not be present in every application, but may be necessary for other applications. These artifacts should be considered on a case-by-case basis. Some of those cases that are slight variations and some of the corner cases are discussed in the following paragraphs.
For example, you may want to include a docs/
directory at locations other than those shown in Figure 1.1: J2EE Applications: Recommended Directory Structure
. An EJB module or a Web module may be sufficiently complex so that developers feel it warrants having a its own docs/
directory to describe how to use it, understand it, or run its tests.
Or a project may contain multiple applications, and developers may
include a separate docs/
directory for each application in addition to the top level docs/
directory.
Another issue to consider is that sometimes particular artifacts can be placed in the setup/
directory within an application module. Setup directories may not be
present in every project, and sometimes a project will have multiple setup/
directories. There could be a top level setup/
directory, an individual setup/
directory for each application, and/or a setup/
directory for individual component modules, if needed.
The conventions put forth in Figure 1.1: J2EE Applications: Recommended Directory Structure
can also be extended to support cases not shown. For example, you can
extend these conventions to the case where an application has code that
is shared by several modules within just the application. If you were
to write a set of utility classes to be used by more than one module
and that utility is just local to that application, where would you put
it? In this case, treat this utility as another module. First, create a
directory under myapp1
, at the same level as myapp1-ejb
, and named something like myapp1-utility
.
Next, put the utility class inside that directory. When you build your
application, jar these files up and include that JAR as a module within
your EAR file.
Another example of extending the conventions is to consider how to construct a simple Web application, containing only an EAR file composed of just one WAR file. The Web application follows the Web application project structure as described in Strategy for Web Applications .
Another example of extending the
conventions is to consider how to construct a Web application that is
an EAR file composed of multiple WAR files. What would that case look
like inside this larger project structure? Each Web application follows
the Web application project structure. If individual Web applications
require specific environment configuration, these applications may
provide a setup/
directory specific to that application. The same would be true for a docs/
, lib/
, and test/
directories. For further description on this topic, read Strategy for Web Applications
.
Figure 2.1: Web Applications: Recommended Directory Structure shows a recommended structure for Web projects that use J2EE Web technologies. This is useful for projects that only build a WAR file and may not plan to include it in an EAR file, or for projects that build WAR files as modules to be included in an EAR file, as shown in Strategy for J2EE Applications .
Figure 2.1: Web Applications: Recommended Directory Structure shows the simple case for an application with a single WAR file. For more complex projects containing more than one WAR file, refer to Strategy for Reusable J2EE Components and Modules .
|
Table 2.1: Web Applications: Recommended Directory Contents explains the various directories. Table 1.2: Function of Recommended Files explains the recommended files within these directories.
Table 2.1 : Web Applications: Recommended Directory Contents
Figure 3.1: Reusable J2EE Components: Recommended Directory Structure shows the recommended directory structure for developing a component or module that is delivered as a JAR file to another application. These conventions will help while designing and developing a reuseable component. Examples of such reusable components and modules include a Web framework (such as struts), a set of enterprise beans, a set of JavaServer Pages (JSP) tags, or an applet.
Figure 3.1 : Reusable J2EE Components: Recommended Directory Structure
|
The directory structure is shown in Table 3.1: Reusable J2EE Components: Recommended Directory Contents , and the files within the directories are shown in Table 1.2: Function of Recommended Files .
Table 3.1 : Reusable J2EE Components: Recommended Directory Contents
Refer to the Java Adventure Builder Reference application at http://java.sun.com/blueprints/code/index.html#java_adventure for an example that uses this form of the directory structure.
- Packaging and Deployment of J2EE Applications: http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/deployment/deployment.html .
- Naming Conventions: http://java.sun.com/blueprints/code/namingconventions.html .
- Apache Jakarta Guidelines for Web Applications: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/appdev/source.html .
We welcome your feedback on this document and its contents. You can use either of the following methods for providing feedback to us:
- The Java Blueprints Developer Forum at http://forums.java.sun.com/forum.jsp?forum=121
- The Java Blueprints Feedback page at http://java.sun.com/blueprints/feedback.html
发表评论
-
web.xml里<filter-mapping>中的<dispatcher>作用
2009-12-08 17:20 11224在2.4版本的servlet规范在部属描述符中新增加 ... -
(转)Taglib部署的三种方式
2009-12-04 13:07 0本周,由于项目的需要引入了jstl,但是在jsp页 ... -
Iframe页面请求跳转问题解决
2009-11-04 21:15 5244问题描述: 在父页面的一个Iframe页面中,提交请求后 ... -
JAF简介
2009-11-01 21:05 2563JAF全称是JavaBeans ... -
是 String , StringBuffer 还是 StringBuilder ?
2009-10-18 15:42 1429相信大家对 String 和 StringBuffer 的区别 ... -
选择Java接口还是抽象类
2009-10-17 16:23 3495关于java接口与 ... -
Java接口与Java抽象类的区别
2009-10-17 16:01 1417Java接口与Java抽象类的区别: 1. Java抽 ... -
为何不能通过返回值来区分重载方法?
2009-06-28 16:20 3108在java中,重载是其一个非常重要的特性。使用重载,我 ... -
怎么处理警告:编码 GBK 的不可映射字符
2009-04-17 01:31 3067在使用ant编译代码时提示 “编码 GBK 的不可映射字 ... -
既然认为它是好的,就要发挥到极限-系列之二单元测试
2009-03-29 17:07 966(原文)http://www.blogjava.net ... -
weblogic10 下对jVM性能调优设置(参考资料)
2009-03-25 12:36 2915对 JRockit JVM优化 Ta ... -
lazy initialization实现Singleton时synchronized的必要性
2009-03-19 21:48 2474首先了解一下Singleton模式通常的两种表现形式: 第一种 ... -
poi即将提供对OOXML的支持
2008-11-06 23:18 9186POI是apache项目之一,最新版是3.2,它提 ... -
JSP在Servlet中的几个编码的作用及原理
2008-10-05 11:27 1618首先,说说JSP/Ser ... -
使用jconsole监控Apusic
2008-08-19 10:39 1608JDK 1.5+提供了jconsole工具,可以对JVM实例的 ... -
jconsole+tomcat配置说明(基于jdk5.0)
2008-08-18 23:18 8579最近需要参与一些java程 ... -
CruiseControl配置文档元素详解
2008-07-31 22:16 0<cruisecontrol> & ... -
抽象类和接口的区别
2008-07-26 20:19 1053在Java语言中, abstract class ... -
十个最好的Java性能故障排除工具
2008-07-21 13:00 1450推荐十个最好的Java性能故障排除工具: 1.jconsole ... -
(转)Ant: 大规模应用中的应用
2008-06-23 15:20 1854Large Scale 的应用通常意味着: 目录较多 ...
相关推荐
We’ll look at what it means for you to take a problem and produce a program to solve it from beginning to end. That said, this book focuses a lot on design. How do you design software? What things ...
Getting Started with Spring Microservices begins with an overview of the Spring Framework 5.0, its design patterns, and its guidelines that enable you to implement responsive microservices at scale....
* The code to read state files used by the sequencer machinery for "git status" has been made more robust against a corrupt or stale state files. * "git for-each-ref" with multiple patterns have ...
- **Typing an End-of-File Signal:** Describes the use of EOF signals. - **Dr. P’s Prescriptions:** Offers practical advice and tips. - **C++ Compared with Java:** Compares C++ with Java, highlighting...
If you want to design and develop enterprise applications using .NET Core as the development framework and learn about industry-wide best practices and guidelines, then this book is for you. ...
- **Transitioning to ARC**: Migrating from MRC to ARC requires careful consideration of code patterns and object lifetimes. Xcode provides tools to assist with this transition. ### 17. Typecasting ...
examples that show what "not" to do-and "why not." While the illustrations in the print book are in black and white, you can download full-color versions from the publisher web site for free....