进入workspace, 输入如下命令
mvn archetype:generate -DgroupId=
${project_groupd_ID} -DartifactId=
${project_name} -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
下面的命令将生成一个名字为test-web,所在组为com.test的Web项目
mvn archetype:generate -DgroupId=com.test -DartifactId=test-web -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
进入所生成的项目的目录下,
cd test-web
下面的命令用来生成Eclipse项目所需的相关文件,
-Dwtpversion=2.0选项
必定要加上,他会帮助生成.seeting目录下的相关文件
mvn eclipse:eclipse -Dwtpversion=2.0
在Eclipse中导入该项目
这时可能会报如下错误
java compiler level does not match the version of the installed Jave project facet
这是由于.setting目录下文件org.eclipse.wst.common.project.facet.core.xml配置不当所致。
咱们须要打开该文件并将<installed facet="jst.java" version="1.4"/>里的1.4改成1.5或更高(这要根据项目产实际状况),保存修改后,在Eclipse里刷新该项目错误将消失。
以后若是再往项目里添加包时,须要运行下面的命令来导入包,
必定
不能加选项-Dwtpversion=2.0,不然他会把咱们上面所作的修改还原 mvn eclipse:eclipse