2017-02-28 80 views
0

我正在將類型爲Java Web Project的項目更改爲類型項目:Maven Web Project,並且我遇到了pom.xml文件和依賴關係的問題。存檔pom.xml Maven Hibernate

的pom.xml

<dependencies> 
    <dependency> 
      <groupId>mysql</groupId> 
      <artifactId>mysql-connector-java</artifactId> 
      <version>5.1.40</version> 
    </dependency> 
    <dependency> 
     <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-core</artifactId> 
      <version>4.3.1.Final</version> 
    </dependency> 
    <dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-entitymanager</artifactId> 
     <version>4.3.1.Final</version> 
    </dependency> 
    <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-commons-annotations --> 
    <dependency> 
     <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-commons-annotations</artifactId> 
      <version>4.0.2.Final</version> 
    </dependency> 
    <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-c3p0 --> 
    <dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-c3p0</artifactId> 
      <version>4.3.1.Final</version> 
    </dependency> 

    <dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-ehcache</artifactId> 
     <version>4.3.1.Final</version> 
    </dependency> 
    <dependency> 
     <groupId>javax</groupId> 
     <artifactId>javaee-web-api</artifactId> 
     <version>7.0</version> 
     <scope>provided</scope> 
    </dependency> 

    <dependency> 
     <groupId>org.apache.poi</groupId> 
     <artifactId>poi</artifactId> 
     <version>3.15</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.poi</groupId> 
     <artifactId>poi-ooxml</artifactId> 
     <version>3.15</version> 
    </dependency> 

    </dependencies> 

和NetBeans生成此錯誤:

**Could not find artifact org.hibernate:hibernate-commons- annotations:jar:4.0.2.Final in unknown-jars-temp-repo** 

任何解決方案?謝謝!

回答

1

看起來像net beans爲其無法識別的依賴關係添加存儲庫unknown-jars-temp-repo。檢查this

但是,您的問題看起來是不正確的組ID爲hibernate-commons-annotations。它應該是org.hibernate.common而不是org.hibernate如果你想從Maven central下載。

前往搜索maven central如果您遇到類似問題。