spring學習2-工程的pom.xml配置

pom.xml是maven的東西,因爲如今spring的包管理都用這個,我就順便學習一下簡單的使用。html

在上篇博客中,我使用了maven的quitestart模版,在工程的目錄下就自動生成了一個pom.xml,打開xml能夠看到裏面的信息很簡單,最上方是工程的基本信息,有以前填寫的groupid, artifactid,我主要用到的是下面管理包依賴關係的dependenciesspring

  
< dependencies > < dependency > < groupId > junit </ groupId > < artifactId > junit </ artifactId > < version > 3.8.1 </ version > < scope > test </ scope > </ dependency > </ dependencies >

能夠看到,默認maven爲咱們添加了junit的包引用,這裏咱們添加一下spring的基本包。在官方的文檔上,能夠找到依賴的例子,我改了一下版本號,使用大多數人都在用的3.2.8,最新的版本是4.0.2maven

  
< dependencies > < dependency > < groupId > org.springframework </ groupId > < artifactId > spring-context </ artifactId > < version > 3.2.8.RELEASE </ version > < scope > runtime </ scope > </ dependency > </ dependencies >

添加完保存後,maven就會自動去下載相應的包了。學習

image

 

備註:ui

maven依賴包的地址查找spa

http://mvnrepository.com/.net

相關文章
相關標籤/搜索