创建maven web工程,报如下错误:
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>
</build>
由于项目未指定maven war编译插件,添加以上代码后Run Maven4MyEclipse->Update Project or use Quick
本文介绍了解决Maven Web项目中因未指定版本而导致的构建错误的方法。通过在pom.xml文件中配置maven-war-plugin插件的具体版本,可以成功避免此错误并完成项目的构建。
1728

被折叠的 条评论
为什么被折叠?



