关于Maven Maven : 翻译为”专家”、”内行”,是Apache 下的一个纯Java开发的一个开源项目。
Maven 是一个项目管理工具,使用Maven可以来管理企业级的Java项目开发及依赖的管理。
使用Maven 开发,可以简化项目配置,统一项目结构。总之,Maven可以让开发者的工作变得更简单。
Maven的安装和配置 配置环境
Maven 是一个基于 Java 的工具,所以要做的第一件事情就是安装 JDK。
Maven对JDK的要求主要是
Maven 3.3 要求 JDK 1.7 或以上
Maven 3.2 要求 JDK 1.6 或以上
Maven 3.0/3.1 要求 JDK 1.5 或以上
最后使用java -version
命令来检查是否安装jdk成功以及验证版本是否正确
Maven的下载 可在Maven官网进行下载:下载地址
系统
包名
Windows
apache-maven-3.3.9-bin.zip
Linux
apache-maven-3.3.9-bin.tar.gz
添加Maven环境变量 添加环境变量 MAVEN_HOME:
系统
配置
Windows
右键 “计算机”,选择 “属性”,之后点击 “高级系统设置”,点击”环境变量”,来设置环境变量,有以下系统变量需要配置:新建系统变量 MAVEN_HOME ,变量值:你的Maven项目安装目录 编辑系统变量 Path ,添加变量值:;%MAVEN_HOME%\bin
Linux
下载解压: # wget http://mirrors.hust.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz # tar -xvf apache-maven-3.3.9-bin.tar.gz # sudo mv -f apache-maven-3.3.9 /usr/local/
编辑 /etc/profile 文件 sudo vim /etc/profile,在文件末尾添加如下代码: export MAVEN_HOME=/usr/local/apache-maven-3.3.9export PATH=${PATH}:${MAVEN_HOME}/bin
保存文件,并运行如下命令使环境变量生效:# source /etc/profile在控制台输入如下命令,如果能看到 Maven 相关版本信息,则说明 Maven 已经安装成功: # mvn -v
Maven的配置文件基本设置 配置文件路径一般在Maven项目路径的conf目录中
本地仓库设置
maven指定的本地仓库的默认位置是在c盘,默认在:C:/Users/{当前用户}/.m2/repository,也可通过修改<localRepository/>
标签来修改仓库路径
代理服务器设置 一些公司和部门有专有的防火墙设置,使用http代理服务器来阻止用户直接访问互联网,因此还需要为maven设置代理才能使maven正常下载依赖包
取消<proxies>
标签内的代理服务器配置注释,并配置正确的代理服务器
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 <proxies > <proxies > <proxy > <id > optional</id > <active > true</active > <protocol > http</protocol > <username > yiibai</username > <password > password</password > <host > proxy.yiibai.com</host > <port > 8888</port > <nonProxyHosts > local.net|some.host.com</nonProxyHosts > </proxy > </proxies >
Maven中央仓库 查找依赖包 如果Maven的本地仓库没有找到指定依赖,会直连中央仓库 获取依赖,也可直接访问这个中央仓库路径找到想要的依赖包
直接从目录中找依赖包可能不太方便,因此可在改版后的Maven中心存储网站 查找依赖包
不过目前比较常用的是通过https://mvnrepository.com来查找依赖
依赖配置 依赖配置添加在pom.xml文件中的<dependencies>
标签内,以log4j为例
1 2 3 4 5 6 7 <dependencies > <dependency > <groupId > log4j</groupId > <artifactId > log4j</artifactId > <version > 1.2.14</version > </dependency > </dependencies >
配置远程仓库
在settings文件中配置私服服务器为私服服务器 或者云服务器 。如果不配置默认连接的是中央仓库 ,由于中央仓库面对的是全球用户,所以在下载jar包时,效率可能会比较低。,配置方法如下
1 2 3 4 5 6 7 8 9 <mirrors > <mirror > <id > nexus-aliyun</id > <mirrorOf > *</mirrorOf > <name > Nexus aliyun</name > <url > http://maven.aliyun.com/nexus/content/groups/public</url > </mirror > </mirrors >
关于私库如何搭建请参考搭建私库
Maven仓库调用流程 在一般情况下,依赖包拉取流程如下
从本地获取依赖,若没有则执行2
从私库获取依赖,若没有则执行3(第二步需要有自定义的私库,若没有则直接执行第三步)
从远程仓库获取依赖,若没有则报错
当我们需要的依赖既不存在于本地仓库,也不存在于远程的中央仓库(资源库)时,需要手动设置仓库拉取依赖;修改项目的pom.xml文件添加如下配置
1 2 3 4 5 6 <repositories > <repository > <id > 资源库ID</id > <url > 指定仓库的路径</url > </repository > </repositories >
配置后在以上的依赖顺序上多出一条
从配置url指定仓库获取依赖,若没有则报错退出
实际上3和4就是同事进行的(或者说先后顺序依赖于配置文件位置),由于我们可以在pom文件中配置多个仓库,所以会根据配置的仓库数一一查找依赖
当然,如果是大型项目的情况下会有多个工程,而每个工程均会有pom.xml文件,且在未来会有越来越多的项目;这是为省去配置的麻烦,可以为Maven设置全局仓库配置。
全局配置主要是利用setting.xml文件中的<profiles><profile>.....</profile></profiles>
标签,该标签不仅能配置jar包依赖仓库,还能配置Maven插件依赖仓库<pluginRepositories>
等。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 <profiles > <profile > <id > myRepository1</id > <repositories > <repository > <id > myRepository1_1</id > <url > http://maven.aliyun.com/nexus/content/groups/public/</url > <releases > <enabled > true</enabled > </releases > <snapshots > <enabled > true</enabled > <updatePolicy > always</updatePolicy > </snapshots > </repository > </repositories > </profile > <profile > <id > myRepository2</id > <repositories > <repository > <id > myRepository2_1</id > <url > http://repository.jboss.org/nexus/content/groups/public-jboss/</url > <releases > <enabled > true</enabled > </releases > <snapshots > <enabled > true</enabled > <updatePolicy > always</updatePolicy > </snapshots > </repository > </repositories > </profile > </profiles > <activeProfiles > <activeProfile > myRepository1</activeProfile > <activeProfile > myRepository2</activeProfile > </activeProfiles >
项目构建 new一个Maven项目,是否选用骨架均可。
Maven项目目录介绍
/src/main/java – 主目录下的Java目录,用于存放项目中的.java文件
/src/main/resources – 主目下的资源目录,存放项目中的资源文件(如框架的配置文件)
/src/test/java – 测试目录下的Java目录,用于存放所有单元测试类的.java文件,如Junit测试类
/src/test/resources – 测试目录下的资源目录,用于存放测试类所需资源文件(如框架的配置文件)
/target – 项目输出目录,编译后的class文件、及项目打成的war包等会输出到此目录中
/pom.xml – maven项目的核心配置文件,文件中通过坐标来管理项目中的所有jar包和插件。
Maven的pom文件 POM( Project Object Model,项目对象模型 ) 是 Maven 工程的基本工作单元,是一个XML文件,包含了项目的基本信息,用于描述项目如何构建,声明项目依赖,等等
执行任务或目标时,Maven 会在当前目录中查找 POM。它读取 POM,获取所需的配置信息,然后执行目标。
POM 中可以指定以下配置:
项目依赖
插件
执行目标
项目构建 profile
项目版本
项目开发者列表
相关邮件列表信息
Maven项目描述 在创建 POM 之前,我们首先需要描述项目组 (groupId), 项目的唯一ID。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 <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> <!-- 公司或者组织的唯一标志,并且配置时生成的路径也是由此生成, 如com.companyname.project-group,maven会将该项目打成的jar包放本地路径:/com/companyname/project-group --> <groupId>com.companyname.project-group</groupId> <!-- 项目的唯一ID,一个groupId下面可能多个项目,就是靠artifactId来区分的 --> <artifactId>project</artifactId> <!-- 版本号 --> <version>1.0 </version> </project>
所有 POM 文件都需要 project 元素和三个必需字段:groupId,artifactId,version。
节点
描述
project
工程的根标签。
modelVersion
模型版本需要设置为 4.0。
groupId
这是工程组的标识。它在一个组织或者项目中通常是唯一的。例如,一个银行组织 com.companyname.project-group 拥有所有的和银行相关的项目。
artifactId
这是工程的标识。它通常是工程的名称。例如,消费者银行。groupId 和 artifactId 一起定义了 artifact 在仓库中的位置。
version
这是工程的版本号。在 artifact 的仓库中,它用来区分不同的版本。例如:com.company.bank:consumer-banking:1.0com.company.bank:consumer-banking:1.1
必要的Pom 关于父类(Super)pom 父类(Super)pom类似于java中的超类,由于pom有父子继承的关系,子类可以直接继承父类所有的pom配置,一般父 POM 会包含一些可被继承的默认设置。
当 Maven 发现需要下载 POM 中的 依赖时,它会到 Super POM 中配置的默认仓库 去下载。
Super pom 加上工程自己的配置pom最终会生成一个 effective pom,通过这个 effective pom来执行相关需要的依赖等操作
可以用mvn help:effective-pom
指令来下载查看当前的effective pom(前提是当前目录会有一个pom文件,可进入新创建的maven工程目录查看)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 <?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 h ttp://maven.apache.org/xsd/maven-4.0.0.xsd" > <modelVersion > 4.0.0</modelVersion > <groupId > com.companyname.project-group</groupId > <artifactId > project</artifactId > <version > 1.0</version > <build > <sourceDirectory > C:/MVN/project/src/main/java</sourceDirectory > <scriptSourceDirectory > src/main/scripts</scriptSourceDirectory > <testSourceDirectory > C:/MVN/project/src/test/java</testSourceDirectory > <outputDirectory > C:/MVN/project/target/classes</outputDirectory > <testOutputDirectory > C:/MVN/project/target/test-classes</testOutputDirectory > <resources > <resource > <mergeId > resource-0</mergeId > <directory > C:/MVN/project/src/main/resources</directory > </resource > </resources > <testResources > <testResource > <mergeId > resource-1</mergeId > <directory > C:/MVN/project/src/test/resources</directory > </testResource > </testResources > <directory > C:/MVN/project/target</directory > <finalName > project-1.0</finalName > <pluginManagement > <plugins > <plugin > <artifactId > maven-antrun-plugin</artifactId > <version > 1.3</version > </plugin > <plugin > <artifactId > maven-assembly-plugin</artifactId > <version > 2.2-beta-2</version > </plugin > <plugin > <artifactId > maven-clean-plugin</artifactId > <version > 2.2</version > </plugin > <plugin > <artifactId > maven-compiler-plugin</artifactId > <version > 2.0.2</version > </plugin > <plugin > <artifactId > maven-dependency-plugin</artifactId > <version > 2.0</version > </plugin > <plugin > <artifactId > maven-deploy-plugin</artifactId > <version > 2.4</version > </plugin > <plugin > <artifactId > maven-ear-plugin</artifactId > <version > 2.3.1</version > </plugin > <plugin > <artifactId > maven-ejb-plugin</artifactId > <version > 2.1</version > </plugin > <plugin > <artifactId > maven-install-plugin</artifactId > <version > 2.2</version > </plugin > <plugin > <artifactId > maven-jar-plugin</artifactId > <version > 2.2</version > </plugin > <plugin > <artifactId > maven-javadoc-plugin</artifactId > <version > 2.5</version > </plugin > <plugin > <artifactId > maven-plugin-plugin</artifactId > <version > 2.4.3</version > </plugin > <plugin > <artifactId > maven-rar-plugin</artifactId > <version > 2.2</version > </plugin > <plugin > <artifactId > maven-release-plugin</artifactId > <version > 2.0-beta-8</version > </plugin > <plugin > <artifactId > maven-resources-plugin</artifactId > <version > 2.3</version > </plugin > <plugin > <artifactId > maven-site-plugin</artifactId > <version > 2.0-beta-7</version > </plugin > <plugin > <artifactId > maven-source-plugin</artifactId > <version > 2.0.4</version > </plugin > <plugin > <artifactId > maven-surefire-plugin</artifactId > <version > 2.4.3</version > </plugin > <plugin > <artifactId > maven-war-plugin</artifactId > <version > 2.1-alpha-2</version > </plugin > </plugins > </pluginManagement > <plugins > <plugin > <artifactId > maven-help-plugin</artifactId > <version > 2.1.1</version > </plugin > </plugins > </build > <repositories > <repository > <snapshots > <enabled > false</enabled > </snapshots > <id > central</id > <name > Maven Repository Switchboard</name > <url > http://repo1.maven.org/maven2</url > </repository > </repositories > <pluginRepositories > <pluginRepository > <releases > <updatePolicy > never</updatePolicy > </releases > <snapshots > <enabled > false</enabled > </snapshots > <id > central</id > <name > Maven Plugin Repository</name > <url > http://repo1.maven.org/maven2</url > </pluginRepository > </pluginRepositories > <reporting > <outputDirectory > C:/MVN/project/target/site</outputDirectory > </reporting > </project >
在上面的 pom.xml 中,你可以看到 Maven 在执行目标时需要用到的默认工程源码目录结构、输出目录、需要的插件、仓库和报表目录。
Maven 的 pom.xml 文件也不需要手工编写。Maven 提供了大量的原型插件来创建工程,包括工程结构和 pom.xml。
POM 标签大全详解 随便看看吧,了解一下即可,不经常用的早晚会忘记
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 <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.0http://maven.apache.org/maven-v4_0_0.xsd" > <parent > <artifactId /> <groupId /> <version /> <relativePath /> </parent > <modelVersion > 4.0.0</modelVersion > <groupId > asia.banseon</groupId > <artifactId > banseon-maven2</artifactId > <packaging > jar</packaging > <version > 1.0-SNAPSHOT</version > <name > banseon-maven</name > <url > http://www.baidu.com/banseon</url > <description > A maven project to study maven.</description > <prerequisites > <maven /> </prerequisites > <issueManagement > <system > jira</system > <url > http://jira.baidu.com/banseon</url > </issueManagement > <ciManagement > <system /> <url /> <notifiers > <notifier > <type /> <sendOnError /> <sendOnFailure /> <sendOnSuccess /> <sendOnWarning /> <address /> <configuration /> </notifier > </notifiers > </ciManagement > <inceptionYear /> <mailingLists > <mailingList > <name > Demo</name > <post > banseon@126.com</post > <subscribe > banseon@126.com</subscribe > <unsubscribe > banseon@126.com</unsubscribe > <archive > http:/hi.baidu.com/banseon/demo/dev/</archive > </mailingList > </mailingLists > <developers > <developer > <id > HELLO WORLD</id > <name > banseon</name > <email > banseon@126.com</email > <url /> <roles > <role > Project Manager</role > <role > Architect</role > </roles > <organization > demo</organization > <organizationUrl > http://hi.baidu.com/banseon</organizationUrl > <properties > <dept > No</dept > </properties > <timezone > -5</timezone > </developer > </developers > <contributors > <contributor > <name /> <email /> <url /> <organization /> <organizationUrl /> <roles /> <timezone /> <properties /> </contributor > </contributors > <licenses > <license > <name > Apache 2</name > <url > http://www.baidu.com/banseon/LICENSE-2.0.txt</url > <distribution > repo</distribution > <comments > A business-friendly OSS license</comments > </license > </licenses > <scm > <connection > scm:svn:http://svn.baidu.com/banseon/maven/banseon/banseon-maven2-trunk(dao-trunk) </connection > <developerConnection > scm:svn:http://svn.baidu.com/banseon/maven/banseon/dao-trunk </developerConnection > <tag /> <url > http://svn.baidu.com/banseon</url > </scm > <organization > <name > demo</name > <url > http://www.baidu.com/banseon</url > </organization > <build > <sourceDirectory /> <scriptSourceDirectory /> <testSourceDirectory /> <outputDirectory /> <testOutputDirectory /> <extensions > <extension > <groupId /> <artifactId /> <version /> </extension > </extensions > <defaultGoal /> <resources > <resource > <targetPath /> <filtering /> <directory /> <includes /> <excludes /> </resource > </resources > <testResources > <testResource > <targetPath /> <filtering /> <directory /> <includes /> <excludes /> </testResource > </testResources > <directory /> <finalName /> <filters /> <pluginManagement > <plugins > <plugin > <groupId /> <artifactId /> <version /> <extensions /> <executions > <execution > <id /> <phase /> <goals /> <inherited /> <configuration /> </execution > </executions > <dependencies > <dependency > ...... </dependency > </dependencies > <inherited /> <configuration /> </plugin > </plugins > </pluginManagement > <plugins > <plugin > <groupId /> <artifactId /> <version /> <extensions /> <executions > <execution > <id /> <phase /> <goals /> <inherited /> <configuration /> </execution > </executions > <dependencies > <dependency > ...... </dependency > </dependencies > <goals /> <inherited /> <configuration /> </plugin > </plugins > </build > <profiles > <profile > <id /> <activation > <activeByDefault /> <jdk /> <os > <name > Windows XP</name > <family > Windows</family > <arch > x86</arch > <version > 5.1.2600</version > </os > <property > <name > mavenVersion</name > <value > 2.0.3</value > </property > <file > <exists > /usr/local/hudson/hudson-home/jobs/maven-guide-zh-to-production/workspace/ </exists > <missing > /usr/local/hudson/hudson-home/jobs/maven-guide-zh-to-production/workspace/ </missing > </file > </activation > <build > <defaultGoal /> <resources > <resource > <targetPath /> <filtering /> <directory /> <includes /> <excludes /> </resource > </resources > <testResources > <testResource > <targetPath /> <filtering /> <directory /> <includes /> <excludes /> </testResource > </testResources > <directory /> <finalName /> <filters /> <pluginManagement > <plugins > <plugin > <groupId /> <artifactId /> <version /> <extensions /> <executions > <execution > <id /> <phase /> <goals /> <inherited /> <configuration /> </execution > </executions > <dependencies > <dependency > ...... </dependency > </dependencies > <goals /> <inherited /> <configuration /> </plugin > </plugins > </pluginManagement > <plugins > <plugin > <groupId /> <artifactId /> <version /> <extensions /> <executions > <execution > <id /> <phase /> <goals /> <inherited /> <configuration /> </execution > </executions > <dependencies > <dependency > ...... </dependency > </dependencies > <goals /> <inherited /> <configuration /> </plugin > </plugins > </build > <modules /> <repositories > <repository > <releases > <enabled /> <updatePolicy /> <checksumPolicy /> </releases > <snapshots > <enabled /> <updatePolicy /> <checksumPolicy /> </snapshots > <id /> <name /> <url /> <layout /> </repository > </repositories > <pluginRepositories > <pluginRepository > <releases > <enabled /> <updatePolicy /> <checksumPolicy /> </releases > <snapshots > <enabled /> <updatePolicy /> <checksumPolicy /> </snapshots > <id /> <name /> <url /> <layout /> </pluginRepository > </pluginRepositories > <dependencies > <dependency > ...... </dependency > </dependencies > <reports /> <reporting > ...... </reporting > <dependencyManagement > <dependencies > <dependency > ...... </dependency > </dependencies > </dependencyManagement > <distributionManagement > ...... </distributionManagement > <properties /> </profile > </profiles > <modules /> <repositories > <repository > <releases > <enabled /> <updatePolicy /> <checksumPolicy /> </releases > <snapshots > <enabled /> <updatePolicy /> <checksumPolicy /> </snapshots > <id > banseon-repository-proxy</id > <name > banseon-repository-proxy</name > <url > http://192.168.1.169:9999/repository/</url > <layout > default</layout > </repository > </repositories > <pluginRepositories > <pluginRepository > ...... </pluginRepository > </pluginRepositories > <dependencies > <dependency > <groupId > org.apache.maven</groupId > <artifactId > maven-artifact</artifactId > <version > 3.8.1</version > <type > jar</type > <classifier > </classifier > <scope > test</scope > <systemPath > </systemPath > <exclusions > <exclusion > <artifactId > spring-core</artifactId > <groupId > org.springframework</groupId > </exclusion > </exclusions > <optional > true</optional > </dependency > </dependencies > <reports > </reports > <reporting > <excludeDefaults /> <outputDirectory /> <plugins > <plugin > <groupId /> <artifactId /> <version /> <inherited /> <configuration /> <reportSets > <reportSet > <id /> <configuration /> <inherited /> <reports /> </reportSet > </reportSets > </plugin > </plugins > </reporting > <dependencyManagement > <dependencies > <dependency > ...... </dependency > </dependencies > </dependencyManagement > <distributionManagement > <repository > <uniqueVersion /> <id > banseon-maven2</id > <name > banseon maven2</name > <url > file://${basedir}/target/deploy</url > <layout /> </repository > <snapshotRepository > <uniqueVersion /> <id > banseon-maven2</id > <name > Banseon-maven2 Snapshot Repository</name > <url > scp://svn.baidu.com/banseon:/usr/local/maven-snapshot</url > <layout /> </snapshotRepository > <site > <id > banseon-site</id > <name > business api website</name > <url > scp://svn.baidu.com/banseon:/var/www/localhost/banseon-web </url > </site > <downloadUrl /> <relocation > <groupId /> <artifactId /> <version /> <message /> </relocation > <status /> </distributionManagement > <properties /> </project >