在咱們上一篇中已經知道了在Intellij idea下是如何使用Maven的了,建立出來的目錄結構是這樣子的:apache
上面的目錄結構就是Maven所謂的」約定「,咱們使用Maven來構建Java項目,都是這種目錄結構的…服務器
接下來咱們來了解一下Mavaen一些經常使用的術語markdown
本地倉庫maven
中心倉庫:ide
-* 當Maven在本地倉庫和私服找不到咱們須要的jar包的時候,就去中心倉庫中幫咱們下載對應的jar包*。那Maven怎麼知道去哪裏下載呢??其實Maven已經配置好的了測試
apache-maven-3.2.1\lib\maven-model-builder-3.2.1\org\apache\maven\model下的POM.xml文件中已經配置好了ui
<repositories> <repository> <id>central</id> <name>Central Repository</name> <url>http://repo.maven.apache.org/maven2</url> <layout>default</layout> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>central</id> <name>Central Repository</name> <url>http://repo.maven.apache.org/maven2</url> <layout>default</layout> <snapshots> <enabled>false</enabled> </snapshots> <releases> <updatePolicy>never</updatePolicy> </releases> </pluginRepository> </pluginRepositories>
私有服務器url
軟件的生命週期就是如下idea
-* 清除–> 編譯–>測試–>報告–>打包(jar\war)–>安裝–>部署*spa
當咱們使用idea環境下開發,maven生命週期的插件就很是清晰了…
座標的組成: groupId + artifactId+ version
jar包組成:
artifactId-version.jar
pom.xml介紹 :project object model 項目對象模型 ,它是maven核心配置文件
當咱們把上面的術語瞭解完之後,對下面pom.xml配置文件就不會感到陌生了。
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>zhongfucheng3</groupId> <artifactId>zhongfucheng3</artifactId> <version>1.0-SNAPSHOT</version> </project>
若是咱們想要咱們的項目可以有Junit測試的開發包,咱們只要指定對應的jar包依賴就好了..
scope應用範圍有test、compile等等,默認是compile,那麼test和compile有什麼區別呢?
<scope>test</scope>