即使我的java是1.7,也无法将项目facet动态Web模块的版本更改为3.0

时间:2014-11-08 00:49:43

标签: java spring maven

大家,我试图跟随春天4的常规tuto helloworld,所以我使用了maven项目,问题是我在java资源中得到一个错误,当我点击标记我得到以下错误:无法将项目facet动态Web模块的版本更改为3.0 我试图去项目方面,当我尝试将动态Web模块更改为3.0时,他们不允许我这样做,我得到一个正确的消息(Java 1.6或更新版本)和java我正在工作你是1.7,请帮我解决。

            <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
              <modelVersion>4.0.0</modelVersion>
              <groupId>com.programcreek</groupId>
              <artifactId>submit</artifactId>
              <packaging>war</packaging>
              <version>0.0.1-SNAPSHOT</version>
              <name>submit Maven Webapp</name>
              <url>http://maven.apache.org</url>
              <properties>
                    <spring.version>4.0.1.RELEASE</spring.version>
                </properties>
                <dependencies>
                    <dependency>
                        <groupId>junit</groupId>
                        <artifactId>junit</artifactId>
                        <version>3.8.1</version>
                        <scope>test</scope>
                    </dependency>
                    <!-- Spring dependencies -->
                    <dependency>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-core</artifactId>
                        <version>${spring.version}</version>
                    </dependency>

                    <dependency>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-web</artifactId>
                        <version>${spring.version}</version>
                    </dependency>

                    <dependency>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-webmvc</artifactId>
                        <version>${spring.version}</version>
                    </dependency>

                    <dependency>
                        <groupId>jstl</groupId>
                        <artifactId>jstl</artifactId>
                        <version>1.2</version>
                    </dependency>

                </dependencies>


                <build>
                    <finalName>HelloWorld</finalName>
                    <plugins>
                  <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.2</version>
                    <configuration>
                      <source>1.7</source>
                      <target>1.7</target>
                    </configuration>
                  </plugin>






                </plugins>
                </build>


            </project>

这是我的web.xml

            <?xml version="1.0" encoding="UTF-8"?>
            <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
            xmlns="http://java.sun.com/xml/ns/javaee"
             xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 
             id="WebApp_ID" version="3.0">


                <display-name>Archetype Created Web Application</display-name>

                <servlet>
                    <servlet-name>dispatcher</servlet-name>
                    <servlet-class>
                        org.springframework.web.servlet.DispatcherServlet
                    </servlet-class>
                    <load-on-startup>1</load-on-startup>
                </servlet>

                <servlet-mapping>
                    <servlet-name>dispatcher</servlet-name>
                    <url-pattern>/</url-pattern>
                </servlet-mapping>

                <context-param>
                    <param-name>contextConfigLocation</param-name>
                    <param-value>/WEB-INF/dispatcher-servlet.xml</param-value>
                </context-param>

                <listener>
                    <listener-class>
                        org.springframework.web.context.ContextLoaderListener
                    </listener-class>
                </listener>
            </web-app>

1 个答案:

答案 0 :(得分:0)

通过按(alt + f5)或右键单击项目&gt; maven&gt;更新项目来更新项目,然后它将反映出来。