创建maven项目的时候,maven文件头报错:

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>

在project标签内加入以下代码即可解决报错:

<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.1</version>  
                </configuration>  
            </plugin>  
        </plugins>  
        <finalName>webserver</finalName>  
    </build>