Eclipse:在服务器上运行选项对于 Maven 项目不可见
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7014030/
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:Run on server option not visible for maven project
提问by user619804
I'm running through the jboss as7 getting started guide here http://hudson.jboss.org/jenkins/job/JBoss-AS7-Docs/lastSuccessfulBuild/artifact/guides/developer-getting-started-guide/target/docbook/publish/en-US/html/helloworld.html. The tutorial has us setting up an example helloworld quickstart maven project.
我在这里运行 jboss as7 入门指南http://hudson.jboss.org/jenkins/job/JBoss-AS7-Docs/lastSuccessfulBuild/artifact/guides/developer-getting-started-guide/target/docbook/发布/en-US/html/helloworld.html。本教程让我们设置一个示例 helloworld quickstart maven 项目。
I'm able to deploy this project from the command line successfully
我能够从命令行成功部署这个项目
mvn package jboss-as:deploy
but when I attempt to deploy the helloworld example from Eclipse - the 'run on server' option is missing from the run menu. I have Eclipse 3.7 and maven wtp installed.
但是当我尝试从 Eclipse 部署 helloworld 示例时 - 运行菜单中缺少“在服务器上运行”选项。我安装了 Eclipse 3.7 和 maven wtp。
Not sure how to fix, any advice appreciated.
不知道如何解决,任何建议表示赞赏。
回答by Ken Chan
The run on server
related options only appears if your project has the Dynamic Web Moudle
project facets.
在run on server
只有当您的项目有出现相关选项Dynamic Web Moudle
项目方面。
You can try to configure it using the Project Facets
options in your project properties
您可以尝试使用Project Facets
项目属性中的选项对其进行配置
回答by heyomi
To help any other developer with this problem.
帮助任何其他开发人员解决此问题。
I was dealing with this issue recently. Maven projects are structured differently than Dynamic Web Projects. So when you manually add the Dynamic Web Module using Project Facets, eclipse may not register it properly as a Maven project.
我最近正在处理这个问题。Maven 项目的结构与动态 Web 项目不同。因此,当您使用 Project Facets 手动添加动态 Web 模块时,eclipse 可能无法将其正确注册为 Maven 项目。
To solve this, you have to install the m2e pluginand M2E Eclipse WTP plugin(this tells Eclipse how to run your maven projects).
要解决这个问题,您必须安装m2e 插件和M2E Eclipse WTP 插件(这会告诉 Eclipse 如何运行您的 maven 项目)。
Go to Help -> Eclipse Marketplace to search for the plugins.
转至 Help -> Eclipse Marketplace 以搜索插件。
After installing, you will need to restart Eclipse then you will be able to use "run on server" for your Maven projects.
安装后,您将需要重新启动 Eclipse,然后您将能够为您的 Maven 项目使用“在服务器上运行”。
Note: You may need to remove/delete the previous project then import/create it again after the restart.
注意:您可能需要删除/删除以前的项目,然后在重新启动后再次导入/创建它。
回答by Subodh Joshi
You have to add maven eclipse pluginin your pom.xml file..
你必须在你的 pom.xml 文件中添加 maven eclipse 插件..
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
</plugin>
回答by user937605
After copying the project and refreshing it, closing and reopening it, removing and re-adding it (right-click on server) and updating Maven... the option reappeared. I think it occurs when you up the version of the Java compiler in your .pom file, when you up the compiler in project properties or it has to do with using the newer Jersey (2) version or when you both include local libraries and maven dependencies, it may also be a consequence of a combination of these. It's pretty unclear. Note though, that you can still add/remove projects by right-clicking on the server in the servers tab.
复制项目并刷新后,关闭并重新打开它,删除并重新添加它(右键单击服务器)并更新 Maven ......该选项再次出现。我认为当您在 .pom 文件中启动 Java 编译器的版本时,当您在项目属性中启动编译器时,或者与使用较新的 Jersey (2) 版本有关,或者当您同时包含本地库和 maven 时,就会发生这种情况依赖,它也可能是这些组合的结果。这很不清楚。但请注意,您仍然可以通过右键单击服务器选项卡中的服务器来添加/删除项目。
回答by Dave Mulligan
According to Red Hat's site, The M2E Eclipse WTP plugin (m2eclipse-wtp) has been deprecated in favor of the newer m2e-wtp plugin. If you don't want to go through the marketplace, the URL for the new plugin is http://download.eclipse.org/technology/m2e/releases.
根据 Red Hat 的网站,M2E Eclipse WTP 插件 (m2eclipse-wtp) 已被弃用,取而代之的是较新的 m2e-wtp 插件。如果您不想浏览市场,新插件的 URL 是http://download.eclipse.org/technology/m2e/releases。