Java 将 Maven 项目转换为 Eclipse 的动态 Web 项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18036323/
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
Converting Maven project to Dynamic Web Project for Eclipse
提问by Vimal Basdeo
Create a web project using Maven:
mvn archetype:generate -DgroupId=com.trial -DartifactId=message -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
Convert the project to Eclipse web project using:
mvn eclipse:eclipse -Dwtpversion=2.0
Import existing project into Eclipse:
使用 Maven 创建一个 web 项目:
mvn archetype:generate -DgroupId=com.trial -DartifactId=message -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
使用以下命令将项目转换为 Eclipse Web 项目:
mvn eclipse:eclipse -Dwtpversion=2.0
将现有项目导入 Eclipse:
The project icon contains an folder instead of a web icon and folder icon. I find this a bit strange and when I try to run also, the run on server option is missing. I am sure I followed the steps correctly. Where may I be lagging to obtains such a result ?
项目图标包含一个文件夹,而不是 Web 图标和文件夹图标。我觉得这有点奇怪,当我也尝试运行时,缺少在服务器上运行选项。我确定我正确地遵循了这些步骤。我在哪里可能会落后于获得这样的结果?
回答by Roman C
WTP version is rather old, you should add a web project features instead. Edit the .project
file and write under the natures
tag
WTP 版本比较老,你应该添加一个 web 项目功能来代替。编辑.project
文件并写在natures
标签下
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
and under the buildSpec
tag add builders
并在buildSpec
标签下添加建设者
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
回答by Nirdesh Sharma
I have the below's suggestions :
我有以下建议:
First check whether your eclipse is in
Jave EE Perspective
or not. If it was in only Java perspective, run option will not come.Right click on your project, go to properties.
Click on
Project Facets
Check whether
Dynamic Web module
is check marked or not. If not just check marked it.
首先检查您的日食是否在
Jave EE Perspective
。如果它只是在 Java 视角中,则不会出现运行选项。右键单击您的项目,转到属性。
点击
Project Facets
检查是否
Dynamic Web module
被选中。如果不只是检查标记它。