Eclipse: The selection did not contain any resource that can run on a server

本小妞迷上赌 提交于 2019-12-05 02:21:17

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.

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

Maybe you sholud update two file in .settings folder in your web project: .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

<?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.

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.

I faced this issue recently in STS
After following below steps error disappeared .

  1. Check default JRE version configured in IDE and check JRE System Library version showing in project
  2. If versions are different ,make them same first .
  3. Now right click on Project and select properties .
  4. Select on Project facets and choose Dynamic Web Module
  5. Refresh the Project.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!