0
votes

everyone , i've tried to follow a regular tuto of helloworld with spring 4 , so i used a maven project , the problem is i get an error in java ressources , and when i click in to the markers i get the following error : cannot change version of project facet dynamic web module to 3.0 i've tried to go to project facets and when i try to change the dynamic web module to 3.0 they don't allow me to that , and i get a message in the right (Java 1.6 or newer) and the java i am working with is 1.7, can you help me resolve that please.

            <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>

and here is my 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
It sound like an IDE (Eclipse?) problem not a Maven problem. (Project facets are nothing to do with Maven per se.) Is the IDE configured to use Java 7 as the target platform?Stephen C

1 Answers

0
votes

update the project by pressing (alt+f5) or right click on project>maven>update project then it will reflect.