一.pom标签
1.dependencies:配置项目需要那些jar包
<dependencies>
<dependency>
<groupId></groupId>
<artifactId></artifactId>
<version></version>
</dependency>
</dependencies>
2.properties:pom中一些属性值
3.build:如何构建项目
source:指定当前构建的source目录
plugin:指定构建时使用的插件
Maven插件:maven实际上是依赖插件执行的框架,每个任务都是由插件完成的。
两种插件:
build plugins:在构建时执行,需要在pom.xml文件中进行配置
<build>
<plugins>
<!--表示一个clean类型的插件-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<plugin>
</plugins>
</build>
reporting pluginbs:在网站生成过程中执行,也需要在pom.xml文件中进行配置
常用插件列表
clean、compiler、jar、war、
4.packging:指定当前构建项目的类型,war,jar,pom
补充:pom文件可以继承,超级pom文件
二.settings
1.<mirrors>
三.maven之archetype
1. maven本身来说,它会帮我们已经定义好了一些archetype,这些archetype是我们开发中常用的一些项目模板,你新建maven项目的时候,只需要选择对应的archetype即可。
2.使用步骤
(1)定义插件
<build>
<plugins>
<!--表示一个archetype类型的插件-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-archetype-plugin</artifactId>
<version>2.5</version>
<plugin>
</plugins>
</build>
(2)在pom.xml所在目录使用mvn archetype:generate 命令
命令:mvn archetype:create-from-project
(3)在pom.xml所在目录会生成一个target目录,里面会生成一个自定义的骨架
(4)在本地安装一下这个archetype
mvn install
就把刚才的archetype安装到了本地,后面就可以使用了
四.maven私服
1.nexus
本地仓库---》私服----》远程仓库