java ee eclipse 配置 ssh框架

时间:2023-03-09 07:52:56
java ee eclipse 配置 ssh框架

mvnDebug tomcat:run 这条命令主要用来远程测试,它会监听远程测试用的8000端口,在eclipse里打开远程测试后,它就会跑起来了,设断点,调试,一切都是这么简单。

0、如果是maven项目,先利用mvn eclipse:eclipse 将maven项目转换为eclipse项目,然后导入eclipse;最好在eclipse里安装tomcat的plugin (也可不装,不影响使用)。

1、如果一个工程不能有错误,找不到javax.servlet.*之类的,在工程的proterty里面选择 targeted runtime。

2、如果部署到本地tomcat时出现"Loading descriptor for project has encountered a problem" 等错误:

Install: JST Server UI, JST Web UI, JST Server Adapters, JST Server Adapters Extension, WST Server Adapters.

(You may also need Eclipse Java EE Developer tools, Eclipse Java Web Developer tools, Java Server Faces tools or JSF tools, Eclipse faceted Project Framework and Eclipse faceted Project Framework JDT Enablement)

3、添加Server服务器时,选择configure runtime enviroments 把服务器的 runtime enviroment全部删除。添加成功后,选择use tomcat installation。

4、若在eclipse启动的tomcat无法进入localhost:8080页面,则可能需要这样修改:

http://*.com/questions/8520267/localhost8080-gives-404-the-requested-resource-is-not-available

Doubleclick the Tomcat server entry in the Servers tab, you'll get the server configuration. At the left column, under Server Locations, select Use Tomcat installation (note, when it is grayed out, read the section leading text! ;) ). This way Eclipse will take full control over Tomcat, this way you'll also be able to access the default Tomcat homepage with the Tomcat Manager when running from inside Eclipse. I only don't see how that's useful while developing using Eclipse.

eclipse中server location灰色,如何修改?

选择window ----show view---services可以看到服务的面板, 若要更改,先把tomcat下的所有項目移除。并右击,clean...之后方可设置。。。启动后将又变为黑色。

4.1、    server options 的选项的意义:  一般情况下勾选上 publish module contexts to separate XML files, 免得eclipse 修改了 tomcat 的 server.xml 文件。

接下来看看图中几个参数的含义:

(1)serve modules without publishing:
让tomcat直接使用WebContent下的东西
省去publish到<workspace>\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
勾上它会将tmp0\wtpwebapps下相关的resources删除,
同时会修改Servers/Tomcat v6.0 Server at localhost-config/servers.xml中的serveModulesWithoutPublish=true
以及tmp0/conf/server.xml中的<Context>配置

(2)publish module contexts to separate XML files

勾选 上后会修改Servers/Tomcat v6.0 Server at localhost-config/servers.xml中的saveSeparateContextFiles=true

同时将tmp0/conf/server.xml中关于该app的<Context>元素

移动到tmp0/conf/Catalina/localhost/appName.xml中..

将用于开发的localhost当成实际应用的server的话(也就是使用开发的tomcat来发布应用),则必须将 conf/Catalina/localhost/appName.xml 删除,不然发布不会成功。

5、如果部署后出现http 404 什么的情况,可以先考虑看看是否是deployment assembly的问题,即部署参数设置不对的问题。

http://josh-persistence.iteye.com/blog/1926808

可能的原因主要有2个:

1. 该项目不是web项目,所以不存在Deployment Assembly 属性。在Eclipse中,怎样将一个非web project变成一个web project?

1)右键项目,选择Project Facets,点击Convert to faceted from

java ee eclipse 配置 ssh框架

2) 配置Project Facets

更改Dynamic Web Module的Version为2.5。(3.0为Java7的)。

如果提示错误,可能需要在Java Compiler设置Compiler compliance level 为1.6。或者需要在此窗口的Java的Version改成1.6。

java ee eclipse 配置 ssh框架

3) 配置 Modify Faceted Project

点击Further configuration available…,弹出Modify Faceted Project窗口

此处是设置web.xml文件的路径,我们输入src/main/webapp。

Generate web.xml deployment descriptor自动生成web.xml文件,可选可不选。

2.
经过1的project转换后,应该能够看到Deployment
Assembly出现了,但如果还么出现,很有可能在Eclipse中Deployment
Assembly被disable了,那么我们需要做的就是将Deployment Assembly选项enable。

在项目所在的工作区间有一个.project文件,打开该文件增加如下这一行用于enable Deployment Assembly属性。

<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>

如下面的.project file.

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <projectDescription>
  3. <name>shortbread</name>
  4. <comment></comment>
  5. <projects>
  6. </projects>
  7. <buildSpec>
  8. <buildCommand>
  9. <name>org.eclipse.jdt.core.javabuilder</name>
  10. <arguments>
  11. </arguments>
  12. </buildCommand>
  13. <buildCommand>
  14. <name>org.eclipse.wst.common.project.facet.core.builder</name>
  15. <arguments>
  16. </arguments>
  17. </buildCommand>
  18. <buildCommand>
  19. <name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
  20. <arguments>
  21. </arguments>
  22. </buildCommand>
  23. <buildCommand>
  24. <name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
  25. <arguments>
  26. </arguments>
  27. </buildCommand>
  28. <buildCommand>
  29. <name>org.eclipse.m2e.core.maven2Builder</name>
  30. <arguments>
  31. </arguments>
  32. </buildCommand>
  33. </buildSpec>
  34. <natures>
  35. <nature>org.eclipse.jdt.core.javanature</nature>
  36. <nature>org.eclipse.m2e.core.maven2Nature</nature>
  37. <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
  38. <nature>com.google.gwt.eclipse.core.gwtNature</nature>
  39. <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
  40. </natures>
  41. </projectDescription>

然后重启Eclipse, 就可在Project的properties中看到Deployment Assembly选项了。

附:设置部署程序集(Web Deployment Assembly)

java ee eclipse 配置 ssh框架

此处列表是,部署项目时,文件发布的路径。

1,我们删除test的两项,因为test是测试使用,并不需要部署。

2,设置将Maven的jar包发布到lib下。

Add -> Java Build Path Entries -> Maven Dependencies -> Finish

设置完成效果图

java ee eclipse 配置 ssh框架