分享

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

 duduwolf 2006-02-21

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./xml/ns/j2ee"
 xmlns:xsi="http://www./2001/XMLSchema-instance"
 xsi:schemaLocation="http://java./xml/ns/j2ee
 http://java./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>

以上的这些部署文件在使用的时候,可能会影响到模块之间的调用。特别是一些非正常的损坏,要及时地查看这些文件,看是不是有这些文件所引起的。

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多