Error in maven's POM.XML file

0

Error

  

cvc-complex-type.2.4.a: Invalid content was found starting with element 'dependency'. One of '{" link ": parent, " link    POM / 4.0.0 ": name," link ": description," link ": url, " link ": prerequisites,    " link ": issueManagement, " link ": ciManagement, " link ": inceptionYear,    " link ": mailingLists, " link ": developers, " link ": contributors, "http: / /    maven.apache.org/POM/4.0.0":licenses, " link ": scm, " link ": organization," link    4.0.0 ": build," link ": profiles," link ": modules, " link " : repositories, "http: //    maven.apache.org/POM/4.0.0":pluginRepositories, " link ": dependencies, " link ": reports," http: //    maven.apache.org/POM/4.0.0":reporting, " link ": dependencyManagement, " link    4.0.0 ": distributionManagement," link ": properties} 'is expected.

POM.XML

<code>
<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>br.com.wdn.curso</groupId>
    <artifactId>intro-spring-mvc</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>


        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>4.3.8.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>4.3.8.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>javax.servlet.jsp-api</artifactId>
            <version>2.3.1</version>
        </dependency>
    <build>
        <finalName>intro-spring-mvc</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <port>9090</port>
                    <path>/${project.build.finalName}</path>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>
</code>
    
asked by anonymous 25.07.2017 / 21:17

1 answer

2

The dependencies reported in your POM should be contained within the <dependencies> tag.

According to the example in documentation :

<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
                      https://maven.apache.org/xsd/maven-4.0.0.xsd">
  ...
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.0</version>
      <type>jar</type>
      <scope>test</scope>
      <optional>true</optional>
    </dependency>
    ...
  </dependencies>
  ...
</project>
    
25.07.2017 / 21:35