1、下載并解壓zip到你自己指定的目錄
2、檢查是否設(shè)定了JAVA_HOME,然后設(shè)定MAVEN_HOME為安裝目錄和Path=%MAVEN_HOME%\bin。
3、將lib\maven.jar 解壓縮,修改其中的default.properties文件中的幾個(gè)屬性。
maven.home.local = d:/maven
maven.repo.local = d:/maven/repository
## ----------------------------------------------------------
## ${user.home}/build.properties
## ----------------------------------------------------------
maven.proxy.host = proxy
maven.proxy.port = 80
maven.proxy.username = username
maven.proxy.password = password
4、maven使用時(shí)會(huì)出現(xiàn)亂碼,這是由于maven.jarorg\apache\maven\messages\messages_zh_CN.properties這個(gè)文件的毛病。
native2ascii進(jìn)行轉(zhuǎn)換,然后重新覆蓋此文件即可。
5、運(yùn)行maven命令,即可生成一系列的文件
6、運(yùn)行maven genapp 即可生成測(cè)試文件,自動(dòng)下載文件,然后就可以 maven java:compile了。
7. default.properties中遠(yuǎn)程repository重新設(shè)置: maven.repo.remote = http://apache.linuxforum.net/dist/java-repository,http://dist.codehaus.org/,http://mirrors.sunsite.dk/maven/,http://public.planetmirror.com/pub/maven,http://www.ibiblio.org/maven,http://www.ganet.org/maven/,http://test.topicus.nl/maven/
maven tutorial :
http://www-900.ibm.com/developerWorks/cn/java/j-maven/
http://www.theserverside.com/articles/article.tss?l=MavenMagic
使用中如果有問題,可以參考下面文章. :) http://java.mblogger.cn/layout/posts/5731.aspx
但我下載的源代碼和原文"Figure 3 "的目錄結(jié)構(gòu)不一致, 只有三個(gè)目錄:service, Foobar-Web,ear. 執(zhí)行結(jié)果不正確.
我分別在這三個(gè)目錄下,分別執(zhí)行maven, 前兩個(gè)已經(jīng)完成,但是在ear目錄下執(zhí)行maven命令,則報(bào)錯(cuò)如下:
"Case-sensitive issue: The dependency xerces:xerces has a case problem. The dependency was either retrieved in the past with the wrong case or has been specified with the wrong case in your project.xml file. Fix your project.xml or update your local repository with the properly-cased file and try again."
讓人郁悶的是, 我把repository里面的xerces目錄刪除,還是只可以完成前兩步,第三步報(bào)同一個(gè)錯(cuò)誤.
我將每個(gè)depency的properties元素刪除,就可以了 sucessful :(
可以請(qǐng)教一下么?