Java 将Maven项目转换为Eclipse的动态Web项目
使用Maven创建web项目:Java 将Maven项目转换为Eclipse的动态Web项目,java,eclipse,maven,eclipse-wtp,project-conversion,Java,Eclipse,Maven,Eclipse Wtp,Project Conversion,使用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: 项目图标包含一个文件夹,
mvn archetype:generate -DgroupId=com.trial -DartifactId=message
-DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
mvn eclipse:eclipse -Dwtpversion=2.0
项目图标包含一个文件夹,而不是web图标和文件夹图标。我觉得这有点奇怪,当我尝试同时运行时,服务器上的run选项丢失了。我确信我正确地遵循了这些步骤。我在哪里可以落后于获得这样的结果?WTP版本比较旧,您应该添加一个web项目功能。编辑
.project
文件,并在natures
标记下写入
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
我有以下建议:
Project Facets
检查动态Web模块
是否被选中。如果不是,就勾选它如果您只想通过使用eclipse而不切换到命令行来创建maven webapp,那么遵循以下步骤会更好 以下步骤适用于Eclipse2020-06
当你在Problems视图中看到红色标记时,它说什么?它说有一些缺少的LIB。我添加了它们,现在它看起来仍然是Java应用程序而不是web应用程序。这对我来说是可行的,如果没有检查,也可以检查java。
<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>