解决maven web项目Cannot detect Web Project version. Please specify version of Web Project through...的错误

来源:互联网 发布:mac卸载双系统 编辑:程序博客网 时间:2024/06/05 11:28

前面已经聊了创建maven web工程,但是问题来了,创建maven web工程之后会出现如下的错误,在pom.xml文件头部 有以下的错误

Cannot detect Web Project version. Please specify version of Web Project through <version> configuration property of war plugin. E.g.: <plugin> <artifactId>maven- war-plugin</artifactId> <configuration> <version>3.0</version> </configuration> </plugin>

解决方法如下:

在pom.xml文件中加入:

<build><plugins><plugin><artifactId>maven-compiler-plugin</artifactId><configuration><source>1.7</source><target>1.7</target></configuration></plugin><plugin><artifactId>maven-war-plugin</artifactId><version>2.4</version><configuration><version>3.0</version></configuration></plugin></plugins><finalName>webserver</finalName></build>
那是因为项目未指定maven war编译插件的错误

4 2
原创粉丝点击