apache-tomcat-9.0.21/conf目錄下修改tomcat-users.xml文件,末尾添加java
<role rolename="manager-gui"/> <user username="admin" password="admin" roles="manager-gui"/>
apache-tomcat-9.0.21/bin目錄下git
啓動: ./startup.sh 中止 ./shutdown.sh
http://localhost:8080/
https://jenkins.io/,下載jenkins.war文件, 放到 apache-tomcat-9.0.21/webapps 目錄下
訪問Jenkins地址:http://localhost:8080/jenkins/
Manage Jenkins-Global Tool Configuration-Maven-安裝Maven,不要在線安裝,很慢。 https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.5.4/binaries/ 下載maven到本地,而後設置maven_homeweb
Git ,設置本地git 文件地址apache
pom.xml須要安裝maven的編譯插件和單元測試插件tomcat
//依賴的文件 <dependencies> <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java --> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>2.53.1</version> </dependency> <!-- https://mvnrepository.com/artifact/org.testng/testng --> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>6.13.1</version> </dependency> <!-- https://mvnrepository.com/artifact/com.codeborne/phantomjsdriver --> <dependency> <groupId>com.codeborne</groupId> <artifactId>phantomjsdriver</artifactId> <version>1.4.4</version> </dependency> </dependencies> <build> <plugins> <plugin> //編譯插件 <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.6.0</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> //單元測試插件 <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.17</version> <configuration> <suiteXmlFiles> //suiteXmlFile是要執行測試的xml,可配置多個 <suiteXmlFile>testng1.xml</suiteXmlFile> <suiteXmlFile>testng2.xml</suiteXmlFile> </suiteXmlFiles> </configuration> </plugin> </plugins> </build>
Manage Jenkins-Manage Plugins,安裝 Maven Integration plugin,重啓jenkins.服務器