Jenkins是一个开源软件项目,是基于Java开发的一种持续集成工具,用于监控持续重复的工作,旨在提供一个开放易用的软件平台,使软件项目可以进行持续集成
个人理解为一连串的脚本组合成为发布的工具
jenkins官方网址
https://www.jenkins.io/download/lts/macos/
MAC 下安装jenkins
brew install jenkins-lts
卸载
brew uninstall jenkins-lts
Uninstalling /opt/homebrew/Cellar/jenkins-lts/2.303.3... (8 files, 72.3MB)
启动方式1:brew services start jenkins-lts
重启动 brew services restart jenkins-lts
启动方式2:
/opt/homebrew/opt/openjdk@11/bin/java -Dmail.smtp.starttls.enable=true -jar /opt/homebrew/opt/jenkins-lts/libexec/jenkins.war --httpListenAddress=127.0.0.1 --httpPort=8080
访问URL http://localhost:8080/
默认控制台出来一串密码
Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:
5396cb930bab4858b18fe1e489abfd85
This may also be found at: /Users/ge/.jenkins/secrets/initialAdminPassword
输入即可,然后选择插件安装
密码忘记了
cd /Users/xxx/.jenkins/users/admin_15012535494078703792
vi config.xml
找到如下内容,进行替换
<hudson.security.HudsonPrivateSecurityRealm_-Details>
<passwordHash>#jbcrypt:$2a$10$oZgKQuNVqiMglf2lqPm2WOfXqZoq5gWt4NvrT1iugjCNEtVDsUP1G</passwordHash>
</hudson.security.HudsonPrivateSecurityRealm_-Details>
<passwordHash>#jbcrypt:$2a$10$oZgKQuNVqiMglf2lqPm2WOfXqZoq5gWt4NvrT1iugjCNEtVDsUP1G</passwordHash>
表示密码为admin
修改完成重启动服务
账户admin
密码admin
点击侧面的Manage Jenkins, 然后选择Manage Plugins, 点击到可选插件里,搜索maven,Maven Integration这个插件打钩安装
需要maven构建插件
Maven Integration plugin
本地JAVA_HOME配置
chmod 773 /etc/profile
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
source /etc/profile
设置git的地址,账户密码
Goals and options
clean package -Dmaven.test.skip=true
点击the tool configuration 去配置maven的选项
/Users/ge/.jenkins/workspace/jenkins001_mvn/target/jenkins001-0.0.1-SNAPSHOT.jar
cd /Users/ge/.jenkins/workspace/jenkins001_mvn/target/
name=`ls |grep jenkins001-|grep -v original`
#删除变量 name从右边开始的第一个.和.后面的所有字符
jarname=${name%.*}
echo ${name}
echo ${jarname}
nohup java -jar ${name} > /Users/ge/Desktop/cc.log &
安装启动
https://www.jianshu.com/p/5f671aca2b5a
jenkins gitlab 配置2022.07.12
http://t.zoukankan.com/gongxr-p-9257434.html
maven构建
https://www.jianshu.com/p/a84cded92117
读取pom.xml生成的jar的版本
http://t.zoukankan.com/keeptesting-p-10970737.html