1. 程式人生 > >學習maven的使用,看到一篇很實用的入門教程 .

學習maven的使用,看到一篇很實用的入門教程 .

如果本地倉庫沒有,則嚮導會去maven的伺服器下載架包,並在控制檯輸出下載日誌如下:
06-8-4 上午09時21分07秒: Local repository folder "" does not exist
06-8-4 上午09時21分11秒: Reading /study/pom.xml
06-8-4 上午09時21分11秒: Local repository folder "" does not exist
06-8-4 上午09時21分18秒: Reading /study/pom.xml
06-8-4 上午09時21分18秒: Local repository folder "" does not exist
06-8-4 上午09時21分19秒: Reading /study/pom.xml
06-8-4 上午09時21分19秒: Local repository folder "" does not exist
06-8-4 上午09時36分33秒: Local repository folder "" does not exist
06-8-4 上午09時37分11秒: Reading / study /pom.xml
06-8-4 上午09時37分11秒: Local repository folder "" does not exist
06-8-4 上午09時37分15秒: Local repository folder "" does not exist
06-8-4 上午09時40分07秒: Local repository folder "" does not exist
06-8-4 上午09時40分08秒: Reading / study /pom.xml
06-8-4 上午09時40分08秒: Local repository folder "" does not exist
06-8-4 上午09時46分24秒: Reading / study /pom.xml
06-8-4 上午09時46分24秒: Local repository folder "" does not exist
06-8-4 上午09時46分28秒: Local repository folder "" does not exist
06-8-4 上午09時46分40秒: Local repository folder "" does not exist
06-8-4 上午09時46分47秒: Local repository folder "" does not exist
06-8-4 上午09時46分47秒: Reading / study /pom.xml
06-8-4 上午09時46分47秒: Local repository folder "" does not exist
06-8-4 上午09 時46 分49 秒: Downloading [central] ->
http://repo1.maven.org/maven2/junit/junit/3.8.1/junit-3.8.1.pom

06-8-4 上午09 時46 分49 秒: Downloaded [central] -> http://repo1.maven.org/maven2/junit/junit/3.8.1/junit-3.8.1.pom
06-8-4 上午09 時46 分51 秒: Downloading [central] -> http://repo1.maven.org/maven2/junit/junit/3.8.1/junit-3.8.1.jar
06-8-4 上午09時47分00秒: Downloaded [central] ->
http://repo1.maven.org/maven2/junit/junit/3.8.1/junit-3.8.1.jar

----------------------------------------------------------------
補充修正:如果出現錯誤提示同時你手頭也有架包的話可以採用maven的指令進行本地化安裝。比如我在安裝hibernate的架包時告訴我jta無法下載。要求本地化安裝,給出的提示如下:
1) javax.transaction:jta:jar:1.0.1B
Try downloading the file manually from:http://java.sun.com/products/jta.Then
, install it using the command:
mvn install:install-file -DgroupId=javax.transaction -DartifactId=jta /  -Dversion=1.0.1B -Dpackaging=jar -Dfile=/path/to/filePath to dependency:
1) com.efn:mywebapp:war:1.0-SNAPSHOT
2) org.hibernate:hibernate:jar:3.1rc2
3) javax.transaction:jta:jar:1.0.1B
----------
1 required artifact is missing.for artifact: com.efn:mywebapp-1.0-SNAPSHOT.war這個提示是說可以先到sun的網站下載jta架包,然後採用命令列的方式按要求安裝,因為我本來就有此架包,於是拷到一個方便的位置,比如c:/,然後在命令列下輸入:
mvn install:install-file -DgroupId=javax.transaction -DartifactId=jta -Dversion=1.0.1B -Dpackaging=jar -Dfile=C:/jta.jar
執行完畢後,一切OK!
--------------------------------------------------------------