格式错误的pom.xml异常Apache Maven

时间:2017-03-14 18:38:38

标签: java xml spring maven pom.xml

你好。我有一个JavaSpring MVC应用程序。我正在尝试使用带有mongodb数据库和apache maven的spring mvc。但是我的pom.xml文件有问题。这是我的pom.xml文件:



<?xml version="1.0" encoding="UTF-8"?>
<project xmln.s="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>finartzProject</groupId>
<artifactId>FinartzProject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>

  <dependencies>
  
  <!-- spring -->
  <dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-webmvc</artifactId>
   <version>4.0.6.RELEASE</version>
  </dependency>
  
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>4.0.6.RELEASE</version>
  </dependency>
  
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-tx</artifactId>
    <version>4.0.6.RELEASE</version>
  </dependency>
  
  
  <!-- jstl -->
  <dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>jstl</artifactId>
  <version>1.2</version>
  </dependency>
  
  <!-- javax servlet -->
  <dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>javax.servlet-api</artifactId>
  <version>3.1.0</version>
  </dependency>
  
  <!-- mongodb -->
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-mongodb</artifactId>
        <version>1.6.1.RELEASE</version>
    </dependency>
	
  
  	<dependency>
  	<groupId>org.mongodb</groupId>
  	<artifactId>mongo-java-driver</artifactId>
  	<version>3.4.0</version>
  	</dependency>
  
  </dependencies>
  
  <build>
  	<pluginManagement>
  	  <plugins>
  	    
  	    
  	    <plugin>
  	      <groupId>org.apache.maven.plugins</groupId>
  	      <artifactId>maven-war-plugin</artifactId>
  	      <version>2.4</version>
  	       <configuration>
  	        <warSourceDirectory>src/main/webapp</warSourceDirectory>
  	        <failOnMissingWebXml>false</failOnMissingWebXml>
  	       </configuration>
  	    </plugin>
  	    
  	<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <executions>
      <execution>
        <id>default-jar</id>
        <phase>never</phase>
      </execution>
    </executions>
    </plugin>
  	    
  	   
  	  </plugins>
  	 </pluginManagement>
  </build>
  
</project>
&#13;
&#13;
&#13;

我收到此消息。

&#13;
&#13;
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Malformed POM C:\Users\Suleyman\workspace\FinartzProject\pom.xml: Unknown attribute 'xmln.s' for tag 'project' (position: START_TAG seen ...apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">... @2:206)  @ C:\Users\Suleyman\workspace\FinartzProject\pom.xml, line 2, column 206
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project finartzProject:FinartzProject:0.0.1-SNAPSHOT (C:\Users\Suleyman\workspace\FinartzProject\pom.xml) has 1 error
[ERROR]     Malformed POM C:\Users\Suleyman\workspace\FinartzProject\pom.xml: Unknown attribute 'xmln.s' for tag 'project' (position: START_TAG seen ...apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">... @2:206)  @ C:\Users\Suleyman\workspace\FinartzProject\pom.xml, line 2, column 206 -> [Help 2]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/ModelParseException
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:5)

你有一个错字,

<project xmln.s

应该是

<project xmlns