標簽(linux): jenkins
筆者Q:972581034 交流群:605799367。有任何疑問可與筆者或加群交流
構建一個maven項目,即為構建java項目。模擬實驗之前先把實驗代碼推送到 gitlab,jenkins要與gitlab建立deploy keys。
開始構建

配置保留構建數量

配置gitlab地址

maven地址,這里如果沒有安裝maven會有報錯提示。先點保存。

安裝maven


如果是手動安裝,解壓到指定目錄后配置環境變量,並在web界面指定MAVEN_HOME即可,需要與jenkins安裝在一台服務器。
按同樣的方式可以安裝jdk

執行構建,這里報錯了,由於是國外yum源連接不。

修改為阿里的!
[root@nexus.rap.jenkins.maven conf]# pwd
/application/maven/conf
[root@nexus.rap.jenkins.maven conf]# cat settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<mirrors>
<mirror>
<id>yoho8</id>
<mirrorOf>*</mirrorOf>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>default</id>
<repositories>
<repository>
<id>public</id>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>default</activeProfile>
</activeProfiles>
</settings>
