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:
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 ?
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.
WTP version is rather old, you should add a web project features instead. Edit the .project
file and write under the natures
tag
<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
<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>
If you want to create maven webapp by only using eclipse without switching to command line, then following the below steps is better.
Following steps work in eclipse 2020-06
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.