最近群里经常有人会问到关于maven构建Appium测试项目以及使用testNG生成测试报告的问题,试着搭建了一下,下面是过程:

jdk安装过程我这里就不说了

一、下载eclipse,推荐下载Eclipse Luna java EE版本,自带maven插件,比较稳定。Eclipse Luna java EE版64位下载地址:http://ftp.yz.yamagata-u.ac.jp/pub/eclipse//technology/epp/downloads/release/luna/SR2/eclipse-jee-luna-SR2-win32-x86_64.zip

二、下载Maven并配置环境变量

从maven官网下载maven程序包:http://apache.opencas.org/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.zip,下载后解压,例如我的目录结构是:

Appium+Maven+TestNG(ReportNG)环境搭建(详细过程)

 

配置环境变量MAVEN_HOME,变量值为maven的根目录:D:\Program Files\apache-maven-3.3.9,在PATH中添加bin的路径:D:\Program Files\apache-maven-3.3.9\bin,

三、配置settings.xml文件,打开maven conf目录下的settings.xml文件,配置maven本地仓库地址,我配置的是F:\repository

 Appium+Maven+TestNG(ReportNG)环境搭建(详细过程)

我还配置了镜像的地址,因为从默认的中央仓库下载依赖包太慢了,在settings.xml中加入下面的代码:

 1 <mirrors>
 2     <!-- mirror | Specifies a repository mirror site to use instead of a given
 3         repository. The repository that | this mirror serves has an ID that matches
 4         the mirrorOf element of this mirror. IDs are used | for inheritance and direct
 5         lookup purposes, and must be unique across the set of mirrors. | -->
 6     <mirror>
 7         <id>nexus-osc</id>
 8         <mirrorOf>central</mirrorOf>
 9         <name>Nexus osc</name>
10         <url>http://maven.oschina.net/content/groups/public/</url>
11     </mirror>
12     <mirror>
13         <id>nexus-osc-thirdparty</id>
14         <mirrorOf>thirdparty</mirrorOf>
15         <name>Nexus osc thirdparty</name>
16         <url>http://maven.oschina.net/content/repositories/thirdparty/</url>
17     </mirror>
18 </mirrors>
mirrors

相关文章: