2016-06-23 17 views
2

私はmaven projectを作成しました。今ではdynamic web projectに依存関係を追加する必要があります。 それでは、spring tutorialという名前の依存関係を追加しました。Maven:解析できませんPOM

問題:は、私が解析問題を得る:

Project build error: Non-parseable POM C:\Users\username\Development\Spring\Projects\MyWebService\pom.xml: Duplicated tag: 'build' (position: START_TAG seen ...\r\n \r\n \r\n ... @60:10)

私のpom.xmlは、次のようになります。

<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>MyWebService</groupId> 
    <artifactId>MyWebService</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>war</packaging> 

    <parent> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-parent</artifactId> 
     <version>1.3.5.RELEASE</version> 
    </parent> 

    <properties> 
     <java.version>1.8</java.version> 
    </properties> 

    <dependencies> 
     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-data-jpa</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>com.h2database</groupId> 
      <artifactId>h2</artifactId> 
     </dependency> 
    </dependencies> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.springframework.boot</groupId> 
       <artifactId>spring-boot-maven-plugin</artifactId> 
      </plugin> 
      <plugin> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>3.5.1</version> 
       <configuration> 
        <source>1.8</source> 
        <target>1.8</target> 
       </configuration> 
      </plugin> 
      <plugin> 
       <artifactId>maven-war-plugin</artifactId> 
       <version>2.6</version> 
       <configuration> 
        <warSourceDirectory>WebContent</warSourceDirectory> 
        <failOnMissingWebXml>false</failOnMissingWebXml> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 

    <repositories> 
     <repository> 
      <id>spring-releases</id> 
      <name>Spring Releases</name> 
      <url>https://repo.spring.io/libs-release</url> 
     </repository> 
     <repository> 
      <id>org.jboss.repository.releases</id> 
      <name>JBoss Maven Release Repository</name> 
      <url>https://repository.jboss.org/nexus/content/repositories/releases</url> 
     </repository> 
    </repositories> 

    <pluginRepositories> 
     <pluginRepository> 
      <id>spring-releases</id> 
      <name>Spring Releases</name> 
      <url>https://repo.spring.io/libs-release</url> 
     </pluginRepository> 
    </pluginRepositories> 


</project> 

日食は、その行をマーク:

enter image description here

Q uiety: pom.xmlに複数のリポジトリを持つのはなぜ間違っていますか?

注: Mavenのバージョン

Name: EMPEDDED, Details: 3.3.9/1.7.0.20160603-1931 - for Name: WORKSPACE, Details: NOT AVAILABLE [3.0,) 
+0

あなたのpom.xmlはうまく構成されていますか、おそらくそれはeclipseのバグですか?それを再起動して、キャッシュをクリアしてください。 – user1516873

+1

repositories要素は継承されているため、継承チェーンの最上部にrepositories要素を定義することで、プロジェクトグループに使用するリポジトリを通常指定します。 あなたの継承チェーンに既にリポジトリが宣言されていると推測しています。他の人をチェックしてください。 – Zeromus

+0

@Zeromusヒントありがとうございます。いくつかの春の依存関係を使用する別のプロジェクトがありますが、リポジトリを継承しません。そのリポジトリが現在のプロジェクトに対してのみ継承されるようにするにはどうすればよいですか? – jublikon

答えて

4

私はあなたのエラーでお\r\n \r\n \r\nを持っていることを見ています。

pom.xmlがANSIではなくUTF-8で正しくエンコードされていることを確認してください。

+1

さて、問題があります。ファイルはBOMのないUTF-8でした。それをUTF-8に変換すると、トリックがかかりました – jublikon

関連する問題