Java Eclipse 中未出现在服务器上运行选项

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4166882/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 12:14:12  来源:igfitidea点击:

Run on server option not appearing in Eclipse

javaeclipse

提问by swingfuture

I'm learning SpringMVC framework and checked out a copy of their code: https://src.springframework.org/svn/spring-samples/mvc-basic/trunk/I can do maven build, install and everything. But on Eclipse, run on server option never appeared. I have tomcat server up and running, also got plugin for eclipse. Why run on server option is missing? This is a Ubuntu machine. When I tried the exact same thing on my Windows machine, everything was fine. It has the same version of eclipse and all sorts of plugins installed as the Ubuntu machine. I was able to launch it from Eclipse "run on server" option there.

我正在学习 SpringMVC 框架并查看了他们的代码副本:https: //src.springframework.org/svn/spring-samples/mvc-basic/trunk/我可以进行 maven 构建、安装和所有操作。但是在 Eclipse 上,在服务器上运行选项从未出现过。我已经启动并运行了 tomcat 服务器,还获得了 eclipse 插件。为什么缺少在服务器上运行选项?这是一台 Ubuntu 机器。当我在我的 Windows 机器上尝试完全相同的事情时,一切都很好。它与 Ubuntu 机器安装了相同版本的 eclipse 和各种插件。我能够从 Eclipse 的“在服务器上运行”选项启动它。

Can someone help me to figure out why? Thanks.

有人可以帮我弄清楚为什么吗?谢谢。

回答by Gábor Lipták

Do you see any servers in server view in eclipse? Probably simply you have not created any server instances.

您是否在 eclipse 的服务器视图中看到任何服务器?可能只是您没有创建任何服务器实例。

回答by Jared

Did you create a Web Project? If you right click on the project and go to Properties > Project Facets is Dynamic Web Module selected?

您是否创建了 Web 项目?如果您右键单击项目并转到“属性”>“项目方面”,是否选择了动态 Web 模块?

回答by David Canós

Perhaps you lost some configuration, check jar dependencies in properties -> Deployment Assembly. If you miss something, try to add dependencies again.

也许您丢失了一些配置,请在属性 -> 部署程序集中检查 jar 依赖项。如果您遗漏了什么,请尝试再次添加依赖项。

in my case, fixing this, Run on Server appear again.

在我的情况下,修复此问题,再次出现在服务器上运行。

回答by Rakesh

Right click on the project, go to "Run as", select "Run configurations" and create a run configuration.

右键单击项目,转到“运行方式”,选择“运行配置”并创建运行配置。

回答by hoonzis

I had a similar issue. The Maven projects have different structure than "Dynamic Web Projects". Eclipse knows only how to deploy the Dynamic Web Projects (project structure used by Web Tools Platform).

我有一个类似的问题。Maven 项目的结构与“动态 Web 项目”不同。Eclipse 只知道如何部署动态 Web 项目(Web 工具平台使用的项目结构)。

In order to solve this and tell Eclipse how to deploy a "maven style" projects, you have to install the M2E Eclipse WTPplugin (I suppose you are already using the m2e plugin).

为了解决这个问题并告诉 Eclipse 如何部署“maven 风格”项目,您必须安装 M2E Eclipse WTP插件(我想您已经在使用 m2e 插件了)。

To install: Preferences->Maven->Discovery->Open Catalog and choose the WTP plugin.

安装:Preferences->Maven->Discovery->Open Catalog 并选择 WTP 插件。

After reinstalling, you will be able to "run on server" those projects which are maven web projects.

重新安装后,您将能够“在服务器上运行”那些是 maven web 项目的项目。

Hope that helps,

希望有所帮助,

回答by alanbartczak

For me worked: Right click on project > Properties > Project Faces > change Configuration from "custom" to "Default configuration for Apache Tomcat v7.0" > OK and then Run on Server option has appeared.

对我来说:右键单击项目> 属性> 项目面> 将配置从“自定义”更改为“Apache Tomcat v7.0 的默认配置”> 确定,然后出现在服务器上运行选项。

回答by Nishat Lakhani

Follow the below steps:

请按照以下步骤操作:

1) Right click on your maven project.

1) 右键单击​​您的 Maven 项目。

2) Select Maven

2)选择Maven

3) Update Project

3) 更新项目

4) check the

4)检查

  • update project configuration from pom.xml

  • refresh workspace resources from local filesystem.

  • clean projects.

  • 从 pom.xml 更新项目配置

  • 从本地文件系统刷新工作区资源。

  • 清洁项目。

That's it.

就是这样。

回答by J Woodchuck

There is only 1 thing that fixed this for me. In the pom.xml, add the tag:

只有一件事为我解决了这个问题。在 pom.xml 中,添加标签:

<packaging>war</packaging>

Then after saving that, when you right click on the project you should now see the "Run As... Run on Server" option showing up.

保存后,当您右键单击该项目时,您现在应该会看到“运行方式...在服务器上运行”选项。

回答by Rodrigo Almeida

The topic is old but today I was facing the same problem, I imported a Maven project and when I tried to add it to Tomcat it did not show the project. What worked for me:
Properties>> Project Facetsand then mark the options:
Dynamic Web Module+ Javaand JavaScript(optional) and then click in apply. I hope it will help someone :)

这个话题很旧,但今天我遇到了同样的问题,我导入了一个 Maven 项目,当我尝试将它添加到 Tomcat 时,它没有显示该项目。什么对我有用
属性>>项目构面,然后标记选项:
动态 Web 模块+ JavaJavaScript(可选),然后单击应用。我希望它会帮助某人:)

回答by Tillu

we have to install the M2E Eclipse WTP plugin To install: Preferences->Maven->Discovery->Open Catalog and choose the WTP plugin.

我们必须安装 M2E Eclipse WTP 插件 安装:Preferences->Maven->Discovery->Open Catalog 并选择 WTP 插件。

And restart eclipse

并重新启动日食