手记

jenkins集成maven获取远程项目

maven环境配置安装

  • 下载地址
  • maven和jdk环境配置
  • 更改maven setting配置文件

git安装

  • yum -y install git
  • whereis git
  • 配置git环境

插件安装

  • Maven Integration(构建maven项目)
  • Git Parameter(分支选择)
  • Branch API
  • Publish Over SSH

全局环境配置(Global Tool Configuration)

  • git配置
  • jdk配置
  • maven配置
  • 如下图

ssh配置获取远程代码

  • 通过ssh授权
    • ssh-keygen -t rsa 一路回车
    • cat /root/.ssh/id_rsa.pub 中信息
    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDhr8Ze+JhuGGznhZhPPRq165O9vHoj+tJ3sp5AZbZOCPD+S1+hmIfgSm8PCMmZTPjNVmBL3ZYQ3J5zNIpP4QFuz2eMsPA0ENeK2pkJqgihklADmQNN6Yl5HoKIlFq+lf+vWvCl7R4eJPsRZcIMceNNvYwPF+X/A7X7NwT8/ppT1TKWtWLNsGYga3IhD+tpUXEx2mY97PqlkWYgV9da+7KTIAcWuzTDKfoUntz9oyZqQjPsqtNudUGNfSnQUBGHptHmLwQgGUCF8I9ZcAiKIYwst6UPVWyiWoagE7jGKBKHvulfha62FRrA9tYELPUeh21XNY5T4lyKLISSPk2oKP/9 root@localhost.localdomain
    
    • 通过gitee码云演示如下
    • cat /root/.ssh/id_rsa
    -----BEGIN RSA PRIVATE KEY-----
    MIIEowIBAAKCAQEA4a/GXviYbhhs54WYTz0ateuTvbx6I/rSd7KeQGW2Tgjw/ktf
    oZiH4EpvDwjJmUz4zVZgS92WENyeczSKT+EBbs9njLDwNBDXitqZCaoIoZJQA5kD
    TemJeR6CiJRavpX/r1rwpe0eHiT71EWXCDHHjTb2MDxfl/wO1+zcE/P6aU9UylrVi
    zbBmIGtyIQ/raVFxMdpmPez6pZFmIFfXWvuykyAHFrs0wyn6FJ7c/aMmakIz7KrT
    bnVBjX0p0FARh6bR5i8EIBlAhfCPWXAIiiGMLLelD1VsolqGoBO4xigSh77pX4Wu
    thUawPbWBCz1HodtVzWOU+JciiyEkj5NqCj//QIDAQABAoIBAHlEqRP5AncOGt6g
    84GIdOTRy9ZFA2B380WsLcqunLH7rfsGZ0F+o2xKsrhiYWlFad90DVRWob83vNBs
    p/FaFxoCykJYBQoFDrymz1rZCcA/zUzRmGvyFBOH6F4ZUVVdZkFEXVDbQ7aw6lOj
    2Qw02g24zxyBG+3WgZ+WJdEHwcdPIiwhQzUqBTfWvUBC3hNsnwm1m/huseFuH86X
    6wAgvROePjq2Lmhld1yAmqixfBqczeA7Y6jhZZNB/fYTVR0slPRg+X9pT/73gIry
    QUP8kya9jhcghw8FCix7jGcQMGCTLBLAJ0DKsFrQbOPrsqoQBU8kIbO44Dv559Da
    /goGu+ECgYEA/YSDx3YVYaWUSWQ9cXt0+Spr1mw90n+xCFPkb0n2FJa7MoLuzb9/
    dwrojLZDFlRAYWYCkNxzOrULTQOyJ8FBkfw1KI/RUZg39Ifz6rJ+CX/SsVvw8mef
    phnVADzePQrR3iPsUivFfT/0cUphuG1c7uWlw9/P5+B//YdraFE8cakCgYEA4+V/
    NwSqKEimuI9Xrrnxl07Ow1xGXONhj37xqxtPdAmdcKn0CvZKdcOJ5vnfaApeffcl
    RPXIfdg1QQZx0k4QREpi55tIBIC5U/j13Akwjgc6mMCy3VFYV9Rq10+6/z8YAK9l
    NYoDa9OwPdSqWi/KanGUjbd6qooBpE/Bfj3UuDUCgYB8niIE7yetey38MZj+aphi
    Tpb5rPVqvrfwBwT4K5waHMniF3h5jNOEWclcOc+ab0nCVtmWCbdeuVXXwqRVZGrt
    7tLWoHNdL3z558ZfrOPFmZ6g7jfvgD568KHCXylDSklFb9Ufw0Jtwf1PnyeP97pB
    +ILWWPMi4TkpD+MdQSl8GQKBgQCtkAMq66qLs4kF1mV49LRCAAsITiZoZ+PNXWjA
    X7RLM2dsfoMWNizPM3S7LGIw4nTEio0fz/A5p4gnVbkp6boJyH061tAqXb7HbTwR
    sA4CnQ7LdzbBx0n42hXklRxdeLfXDb2O4OVqIXaAII780JjgKFBy/eG2MBTABt3e
    P0jaYQKBgFRxj0qkuCmU4m8b+lciDmmNQBK80kh7oHsR2vStq7cJJaQ3LanA7hlC
    yXh4hqSkHV0qN9X4nnH0ht7QWsoVDBqSM8KMcQM1YEhMTBcfUJo+nsnyLQR3Va/K
    8Fab+CPeFx1pBqF176aWe4zl226gD+HLd27XUPavbRvEp4H378jq
    -----END RSA PRIVATE KEY-----
    
    • 配置到 jenkins 凭证中
  • 配置maven构建项目
0人推荐
随时随地看视频
慕课网APP