2012-01-27 123 views
2

我做了Spring MVC和由 here春天,Maven的依賴和罐問題

(運行Ubuntu)的辦公系統上以參考使用Hibernate的。它運行良好並且沒有問題。

當我複製並保存我的家庭系統上的應用程序(運行Windows XP)時,錯誤顯示有些罐子未能傳輸。

此外,這dependecy

<dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-core</artifactId> 
     <version>3.3.2.GA</version> 
     <type>jar</type> 
     <scope>compile</scope> 
    </dependency> 

沒有我的XP系統上運行。

當我將休眠版本更改爲3.6.x時,jar成功傳輸。

我在兩個系統上運行maven 3和m2eclipse。

請諮詢..

+0

你能運行Maven與'-X'開關,並說明錯誤發生的文化本質,而試圖獲取您的XP系統的依賴? – fasseg 2012-01-27 08:17:27

回答

0

您可以通過mvn install:install將該jar手動安裝到.m2目錄中。當您嘗試打包應用程序時,您會看到構建失敗,並建議您執行mvn install:install。從here手動下載jar,做一個mvn安裝:安裝後跟mvn eclipse:eclipse並刷新工作區。

0

看來你有你的Ubuntu系統$HOME/.m2/repository在你的本地庫的一些文件不你的XP機器c:\Documents and Settings\$USER\.m2\repository上存在。

您可以從linux repo複製文件或使用mvn install:install-file來手動更新您的Windows repo。

希望幫助

+0

在查找Maven回購中的罐子之後,我看到hibernate-core 3.3.2.GA在http://mvnrepository.com/artifact/org.hibernate/hibernate-core/3.3.2.GA所以你應該能夠在用maven構建的時候下載它們。 – fasseg 2012-01-27 08:15:32

0

有時Windows下的本地Maven倉庫奇怪(我只用windows,我不能代表其他系統說吧)。這意味着它不會提供以前沒有找到的人造物。

在這種情況下,您在本地.m2目錄中擁有人工製品的子目錄目錄,但它幾乎爲空(除2個文件外)。如果發生這種情況,我刪除該目錄,然後再次調用maven(例如mvn compile)。

0

你可以嘗試通過將Spring存儲庫添加到您的pom文件。

<repository> 
    <em> <id>com.springsource.repository.bundles.release</id></em> 
    <name>EBR Spring Release Repository</name> 
    <url>http:// repository.springsource.com/maven/bundles/release</url> 
</repository> 
<repository> 
    <id>com.springsource.repository.bundles.external</id> 
    <name>EBR External Release Repository</name> 
    <url>http:// repository.springsource.com/maven/bundles/external</url> 
</repository>