zoukankan      html  css  js  c++  java
  • Jenkins安装

    Jenkins结合Maven,能实现web工程的自动化构建和部署,本文记录下Jenkins安装过程。

    1.可以从官网下载Jenkins.war包,一种方式:直接部署在tomcat中;另一种:按Installing Jenkins步骤,将jenkins部署在Docker中;

    2.在使用jenkins之前,还需要再服务器上安装必要的工具,包括maven、git。

    3.安装maven:可以根据官网Installing Apache Maven步骤;

    4.配置maven,需要指定maven的远程仓库信息,如:

    <!-- servers
       | This is a list of authentication profiles, keyed by the server-id used within the system.
       | Authentication profiles can be used whenever maven must make a connection to a remote server.
       |-->
    
      <!-- mirrors
       | This is a list of mirrors to be used in downloading artifacts from remote repositories.
       | 
       | It works like this: a POM may declare a repository to use in resolving certain artifacts.
       | However, this repository may have problems with heavy traffic at times, so people have mirrored
       | it to several places.
       |
       | That repository definition will have a unique id, so we can create a mirror reference for that
       | repository, to be used as an alternate download site. The mirror site will be the preferred 
       | server for that repository.
       |-->
    <servers>
        <server>  
            <id>mavenid</id>  
            <username>admin</username>  
            <password>admin123</password>  
        </server>  
    </servers>
    <mirrors>
        <!-- mirror
         | Specifies a repository mirror site to use instead of a given repository. The repository that
         | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
         | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
         |
        <mirror>
                <id>mavenid</id>
                <url>http://XXXXX/nexus/content/groups/public/</url>
                <mirrorOf>repositoryid</mirrorOf>
        </mirror>
    </mirrors>

    其中server配置连接仓库或镜像的认证信息(在settings.xml中配置,可避免在每个pom中配置),id表示仓库或镜像;mirror表示仓库的镜像。具体setting的含义可参看Settings Reference

    5.安装git,步骤参照起步 - 安装 Git,其中下载git源码地址为:https://mirrors.edge.kernel.org/pub/software/scm/git/

    安装过程中会出现Can't locate ExtUtils/MakeMaker.pm in @INC的错误,解决方案是安装对应文件:yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker

    6.maven和git安装完成后,可以使用jenkins.

    注意:

    (1)配置的时候,如果【源码管理】【Repository URL】处出现无法连接指定的git地址,一般2种解决方案:安装git;添加用户认证

    (2)如果构建的maven工程,在【Build】处出现配置maven版本,需要在【系统配置】【全局工具配置】中配置maven信息,如下,不要勾选【自动安装】。

    7.到此jenkins就可以用于构建部署项目了

    注意:

    (1)需要注意如果部署web工程到tomcat中,tomcat/webapps中需要保留manager项目,其影响自动部署。

    (2)一键部署到多台tomcat的问题,按照Maven Deploy To Multiple Tomcat Servers描述的方法,做环境的时候并没有生效(待处理)

    (3)记得配置tomcat的用户信息,见:部署Tomcat服务时,解决Cannot invoke Tomcat Manager 异常

      

  • 相关阅读:
    一般删除网页数据和jquery下使用Ajax删除数据的区别
    JavaScript 局部刷新
    ASP.net 网站开发知识点总结
    deque
    DHCP协议
    IP分类以及特殊IP
    重载运算符函数及其注意事项
    linux gdb基本概念
    std::vector 源代码
    iterator 的设计原则和traits
  • 原文地址:https://www.cnblogs.com/shuimuzhushui/p/8589213.html
Copyright © 2011-2022 走看看