Eclipse:选择不包含任何可以在服务器上运行的资源
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10790679/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse: The selection did not contain any resource that can run on a server
提问by skip
I am not able to run maven java web application project to the configured tomcat within eclipse ide.
我无法在 eclipse ide 中将 maven java web 应用程序项目运行到配置的 tomcat。
Initially I could right click on the project and run it on tomcat server but ever since I shared the project to a repository I am not able to do that.
最初我可以右键单击该项目并在 tomcat 服务器上运行它,但是自从我将项目共享到存储库后,我就无法做到这一点。
I disconnected the project form the repository and now I I dont even see the Run as -> Run on Server option inside eclipse ide.
我断开了项目与存储库的连接,现在我什至看不到 eclipse ide 中的 Run as -> Run on Server 选项。
I am using m2e plugin version .0.12.1 and eclipse helios and tomcat 6.
我正在使用 m2e 插件版本 .0.12.1 和 eclipse helios 和 tomcat 6。
Could someone help me understand what am I missing here?
有人可以帮助我了解我在这里缺少什么吗?
Thanks.
谢谢。
回答by Nagaraj
PROBLEM
问题
When you try to run the project on the server using "Run on Server" (SA+X+R) option, eclipse returns the following message: The selection did not contain any resources that can run on a server.
当您尝试使用“在服务器上运行”(SA+X+R) 选项在服务器上运行项目时,eclipse 会返回以下消息:所选内容不包含任何可以在服务器上运行的资源。
SOLUTION
解决方案
On the navigation panel, click over the project for pop-up menu, properties, Project Facets, check: - Dynamic Web Module - Java It worked for me try this may be this is your problem
在导航面板上,单击弹出菜单、属性、项目构面的项目,检查: - 动态 Web 模块 - Java 它对我有用试试这可能是你的问题
回答by zhoufoxcn
Maybe you sholud update two file in .settings folder in your web project: .settings/.jsdtscope
也许您应该更新 web 项目中 .settings 文件夹中的两个文件:.settings/.jsdtscope
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/WebContent"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
.settings/org.eclipse.wst.common.component
.settings/org.eclipse.wst.common.component
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="Web">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/" source-path="/src/main/WebContent" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test"/>
<property name="java-output-path" value="/Web/build/classes"/>
<property name="context-root" value="shequwang-web"/>
</wb-module>
change the path="src/main/WebContent"value's as yours in the two files,then restart the IDE.After I done this,it was work well again.
将这两个文件中的path="src/main/WebContent"值更改为您的值,然后重新启动 IDE。完成此操作后,它再次运行良好。
回答by user3123256
I faced this issue recently in STS
After following below steps error disappeared .
我最近在 STS 中遇到了这个问题,
按照以下步骤后,错误消失了。
- Check default JRE version configured in IDE and check JRE System Library version showing in project
- If versions are different ,make them same first .
- Now right click on Project and select properties .
- Select on Project facets and choose Dynamic Web Module
- Refresh the Project.
- 检查 IDE 中配置的默认 JRE 版本并检查项目中显示的 JRE 系统库版本
- 如果版本不同,首先使它们相同。
- 现在右键单击 Project 并选择 properties 。
- 选择项目方面并选择动态 Web 模块
- 刷新项目。
回答by Maco
I don't know if you solved your problem, but I had the exact same problem and could never fix it. Then I saved all my projects, deleted everything else, started Eclipse from 0 as if it had been just downloaded, re-installed plugins and started new projects copying my older projects' stuff. Yes, it took me like an hour and it's not an expert solution but sometimes it's better to just start over.
我不知道你是否解决了你的问题,但我遇到了完全相同的问题并且永远无法解决它。然后我保存了我所有的项目,删除了其他所有内容,从 0 开始 Eclipse 就像刚刚下载一样,重新安装插件并开始复制我旧项目的东西的新项目。是的,我花了一个小时,这不是一个专业的解决方案,但有时最好重新开始。
回答by hamidreza75
copy your project to the other location. go to eclipse and right click on Project and expand runAs. click maven install. if problem presists, remove the project and import it again.
将您的项目复制到其他位置。转到 eclipse 并右键单击 Project 并展开 runAs。单击 maven 安装。如果问题仍然存在,请删除该项目并重新导入。