myeclipse导入eclipse

myeclipse 项目导入至eclipse中不能识别为web项目,也不能部署。 

1.请首先确保你的eclipse是javaee版本的,或者已经安装看wtp插件 

2.然后修改eclipse工程下的.project文件: 

在 <natures> </natures>中加入 

Java代码   收藏代码
  1. <nature>org.eclipse.wst.common.project.facet.core.nature</nature>  
  2.   
  3.     <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>  
  4.   
  5. <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>  



在 <buildSpec> </buildSpec>中加入  

Java代码   收藏代码
  1. <buildCommand>  
  2.         <name>org.eclipse.wst.common.project.facet.core.builder</name>  
  3.         <arguments>  
  4.         </arguments>  
  5. </buildCommand>  
  6.   
  7. <buildCommand>  
  8.         <name>org.eclipse.wst.validation.validationbuilder</name>  
  9.         <arguments>  
  10.         </arguments>  
  11. </buildCommand>  


3.刷新项目,项目->右击->Properties->Project Facets->Modify Project,选择Java和Dynamic Web Module 配置Context Root 和Content Directory 以及源码路径。

context root确定了Tomcat将那些URL请求转发到Web应用.

Web content folder contains the elements of the project necessary to create a Web application. This folder structure maps to the Web application archive (WAR) structure defined by Sun Microsystems.. The following default elements are located in the Web project folder hierarchy:

Note: In the Project Explorer view, Web projects are filtered into folder nodes to customize the display of Web resources for easy management during development. For information on the filtered structure, see  Project Explorer view.
Web Deployment Descriptor
The standard Web application deployment descriptor (the  web.xml file).
JavaSource
Contains the project's Java source code for classes, beans, and servlets. When these resources are added to a Web project, they are automatically compiled and the generated files are added to the WEB-INF/classes directory. The contents of the source directory are not packaged in WAR files unless an option is specified when a WAR file is created.
Note: Though the default name given to the folder is JavaSources, you can change the name by right clicking on the name in the Project Explorer and clicking on  Refactor > Rename.
imported_classes folder
This folder may be created during a WAR import, and contains class files that do not have accompanying source. The  imported_classes folder is a Java classes folder; Java classes folders can also be created using the Web project  Java Build Path properties page.
WebContent folder
The mandatory location of all Web resources, including HTML, JSP, graphic files, and so on. If the files are not placed in this directory (or in a subdirectory structure under this directory), the files will not be available when the application is executed on a server. The Web content folder represents the contents of the WAR file that will be deployed to the server. Any files not under the Web content folder are considered development-time resources (for example, .java files, .sql files, and .mif files), and are not deployed when the project is unit tested or published.
Note: Though the default name given to the folder is  WebContent, you can change the name in the Project Explorer by right-clicking the folder and selecting Refactor Rename or from the Web page of the project's Properties dialog. In a dynamic Web project, changing the folder name will update the Java build output directory.
META-INF
This directory contains the  MANIFEST.MF file, which is used to map class paths for dependent JAR files that exist in other projects in the same Enterprise Application project. An entry in this file will update the run-time project class path and Java build settings to include the referenced JAR files.
theme
The suggested directory for cascading style sheets and other style-related objects.
WEB-INF
Based on the  Sun Microsystems Java Servlet 2.3 Specification, this directory contains the supporting Web resources for a Web application, including the web.xml file and the classes and lib directories.
/classes
This directory is for servlets, utility classes, and the Java compiler output directory. The classes in this directory are used by the application class loader to load the classes. Folders in this directory will map package and class names, as in:  /WEB-INF/classes/com/mycorp/servlets/MyServlet.class.

Do not place any .class files directly into this directory. The .class files are placed in this directory automatically when the Java compiler compiles Java source files that are in the Java Resources directory. Any files placed directly in this directory will be deleted by the Java compiler when it runs.

/lib
The supporting JAR files that your Web application references. Any classes in .jar files placed in this directory will be available for your Web application
Libraries
The supporting JAR files that your Web application references. This folder mirrors the content of the lib folder. In addition, Web Library Projects, which are "virtual" JAR files that do not physically reside in the Web project, but are associated with Java projects elsewhere in your workspace, are included in this folder. They are packaged with your project when you export the application's WAR file.
Note: A library entry on the Java build path will remain there unless the actual JAR file is deleted from the WEB-INF/lib folder. If you remove a library path entry but not the JAR file, the library entry will be re-added to the path automatically.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值