您的位置:首页 > 编程语言 > Java开发

myeclipse中J2EE项目之间的组织结构

2006-02-20 20:05 246 查看
1. 对于eclipse而言,所有的环境地建立只是针对于一个workshop而言,尤其是对于服务器的有关配置。
(具体见cyberArtcle(网页快捕)软件中的eclipse的配置于使用)
2. 对于eclipse中在做web项目时需要外引一些包供程序使用时,要把相关的包放到web-inf/lib下即可。(点击从文件系统中导入即可,同时可以选择相关的包即可,不必用所有的包)。
3.用myeclipse创建的J2EE项目,要注意:它不产生ejb-jar.xml文件。在按1.3的版本规范中可以通过工具xdoclet来
生成它们。在1.4的规范中,就需要自己创建他们。
4 对于有myeclipse插件之后,可以显示图像等文件。这些外部文件加入到工程项目中的办法是:通过导入文件,zip等文件的形式导到指定的目录下。这样对于一些表象的页面,可以在相应的编辑器中编辑好,然后导入项目工程中!
5.对于文件可以采用拖放的办法,来改变父目录。
6.对于eclipse而言,对于js文件的改变不重新构建项目,因此需要改变相关的jsp/servlet等文件,以期在保存是重新构建项目,从而得到保存!
7。对于web application而言,它每一个部分都可单独构建到web容器中,作为单独的模块运行!
8.对于向EJB中导入jar文件时,会以表示类信息的文本的文件导入,这时不能引用相关包的文件。可右健-〉属性-〉源代码,然后引入对应的包即可!(这样区别于上面的是在于他为该包引入了源文件,而上面的引用只在部署的时候才引用到服务器中去)。

在eclipse中生成的web.xml文档中不能使用生成的web-app头,他不支持服务器的本分配置处理
应该使用<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

在eclipse中.project文件是描述各个模块或者是application web中描述各个模块的。例application web中描述各个模块的:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>DLManagementConsole</name> //web application的名
<comment></comment>
<projects> //有关application web的模块配置
<project>DLManagementConsoleWeb</project>
<project>DLManagementMagazineEJB</project>
</projects>
<buildSpec> //编译的一些平台文件
<buildCommand>
<name>com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.ibm.etools.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.ibm.sse.model.structuredbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.genuitec.eclipse.ast.deploy.core.deploymentnature</nature>
<nature>com.genuitec.eclipse.j2eedt.core.earnature</nature>
</natures>
</projectDescription>
模块描述:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>MagazineResearchStageWeb</name>
<comment></comment>
<projects>
<project>MagazineResearchStageEJB</project> //它引所用到的模块
</projects>
<buildSpec>
<buildCommand>
<name>com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.ibm.etools.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.ibm.sse.model.structuredbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.genuitec.eclipse.ast.deploy.core.deploymentnature</nature>
<nature>com.genuitec.eclipse.j2eedt.core.webnature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

.classpath文件是用来描述程序模块编译的classpath:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/> //引用到文件类的包名或ejb的模块名
<classpathentry kind="src" path="/MagazineResearchStageEJB"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> 平台所包含的包
<classpathentry kind="con" path="com.genuitec.eclipse.j2eedt.core.J2EE13_CONTAINER"/>
<classpathentry kind="output" path="WebRoot/WEB-INF/classes"/> //输出到部署指定的文件中
</classpath>
当然在myeclipse平台上还有一些文件时myeclipse对项目的一些描述(.mymetadata文件):
<?xml version="1.0" encoding="UTF-8"?>
<project-module
type="WEB"
name="MagazineResearchStageWeb"
id="myeclipse.1115630257656"
context-root="/MagazineResearchStageWeb"
j2ee-spec="1.3"
archive="MagazineResearchStageWeb.war">
<attributes>
<attribute name="webrootdir" value="WebRoot" />
</attributes>
</project-module>

以上的这些部署文件在使用的时候,可能会影响到模块之间的调用。特别是一些非正常的损坏,要及时地查看这些文件,看是不是有这些文件所引起的。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: