快速建立 maven 項目

Maven的archetype Plugin可能你們都聽過,但不必定都能很好地用好它。缺省地若是你使用web

 

mvn archetype:generate app

 

會從maven的Repository裏查找全部支持的arche types,大概有500~600個。正由於是太多了,因此查找起來非常不方便。maven

其實平時經常使用的arche type也就那麼幾個。像我會用到的:xml

1.simple start it

2. web app方法

3. Groovy basicim

 

很天然的就會考慮,是否是能什麼簡便的方法只須要從這3個組成的list裏選擇就能夠了。 答案固然是: Yes文件

實現步驟以下:(本機的Maven Repository目錄在C:\Users\buha\.m2 )mv

1. 使用mvn archetype:crawl 命令,它會在 C:\Users\buha\.m2\repository目錄下生成一個archetype-catalog.xml文件生成

2.將archetype-catalog.xml移到上一層目錄,也就是C:\Users\buha\.m2

3.這時再運行mvn archetype:generate -DarchetypeCatalog=local 就能夠達到你想要的目的了。

相關文章
相關標籤/搜索