Jenkins安装与配置

来源:互联网 发布:java txt教程 编辑:程序博客网 时间:2024/04/29 06:56
 

 一. Windows XP下安装

    根据jenkins-the-definitive-guide手册第二章进行配置:

    1. JDK 1.7.0_02 ,直接在oracle官网下载,后配置好环境变量

    2. Git 为msysGit-fullinstall-1.7.9-preview20120201

    3.apache-maven-3.0.4-bin.tar.gz (官网链接不知什么原因,有的版本下载下来只有20K,文件不对,一定要选对文件)

   4. jenkins版本为1.4.x

   碰到的问题: 

  1.
  Started by an SCM change
  Building in workspace C:\Documents and Settings\yren\.jenkins\jobs\game-of-life\workspace
  Checkout:workspace / C:\Documents and Settings\yren\.jenkins\jobs\game-of-life\workspace -hudson.remoting.LocalChannel@d41f3
  Using strategy: Default
  Checkout:workspace / C:\Documents and Settings\yren\.jenkins\jobs\game-of-life\workspace -hudson.remoting.LocalChannel@d41f3
  Cloning the remote Git repository
  Cloning repository origin
  Error trying to determine the git version: Error performing command: D:\Program Files\jenkins\msysgit\msysgit\cmd\git.exe --version
  Cannot run program "D:\Program Files\jenkins\msysgit\msysgit\cmd\git.exe" (in directory "C:\Documents and Settings\yren\.jenkins\jobs\game-of-life\workspace"):    

   CreateProcess error=2, ϵͳÕҲ»µ½ָ¶
   Assuming 1.6
  ERROR: Error cloning remote repo 'origin' : Could not clone git@github.com:xxxxx/game-of-life.git

  解决办法:在jenkins的系统配置中,一定要把git的目录设置正确,设置git安装目录中的bin下的git (进行git --version命令时,如果提示缺少dll,则网上找到并放置在git的bin的文

  件夹下即可)

2.
Started by an SCM change
Building in workspace C:\Documents and Settings\yren\.jenkins\jobs\game-of-life\workspace
Checkout:workspace / C:\Documents and Settings\yren\.jenkins\jobs\game-of-life\workspace -hudson.remoting.LocalChannel@1d4f279
Using strategy: Default
Checkout:workspace / C:\Documents and Settings\yren\.jenkins\jobs\game-of-life\workspace -hudson.remoting.LocalChannel@1d4f279
Cloning the remote Git repository
Cloning repository origin
ERROR: Error cloning remote repo 'origin' : Could not clone git@github.com:xxxxxxx/game-of-life.git
hudson.plugins.git.GitException: Could not clone git@github.com:xxxxxx/game-of-life.git
 at hudson.plugins.git.GitAPI.clone(GitAPI.java:245)
 at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1029)
 at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:970)
 at hudson.FilePath.act(FilePath.java:788)
 at hudson.FilePath.act(FilePath.java:770)
 at hudson.plugins.git.GitSCM.checkout(GitSCM.java:970)
 at hudson.model.AbstractProject.checkout(AbstractProject.java:1195)
 at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:576)
 at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:465)
 at hudson.model.Run.run(Run.java:1409)
 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
 at hudson.model.ResourceController.execute(ResourceController.java:88)
 at hudson.model.Executor.run(Executor.java:238)
Caused by: hudson.plugins.git.GitException: Error performing command: D:\Program Files\jenkins\msysgit\msysgit\bin\git.exe clone --progress -o origingit@github.com:xxxxxx/game-of-life.git C:\Documents and Settings\yren\.jenkins\jobs\game-of-life\workspace
Command "D:\Program Files\jenkins\msysgit\msysgit\bin\git.exe clone --progress -o origingit@github.com:xxxxx/game-of-life.git C:\Documents andSettings\yren\.jenkins\jobs\game-of-life\workspace" returned status code 128: Cloning into 'C:\Documents and Settings\yren\.jenkins\jobs\game-of-life\workspace'...
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

解决办法:
SSH设置时,别忘记
$ git config --global user.name "Firstname Lastname"Sets the name of the user for all git instances on the system
$ git config --global user.email "your_email@youremail.com"Sets the email of the user for all git instances on the system
并把操作系统默认目录下的.ssh下的文件拷贝到git的.ssh目录下

二. Ubuntu10.10 下安装jenkins

      根据jenkins-the-definitive-guide手册第二章进行配置:

     1. Git 为Ubuntu自带,版本1.7.1,目录为/usr/lib/git-core

      2. JDK版本为1.7.0_03

           环境变量的设置:

            执行sudo gedit /etc/environment 命令,然后在path中直接添加bin的路径(path=xx/bin:$path这种方式不知为什么不好用)

     3. maven3.0.4,设置环境变量方式与jdk一样

     最终我的环境变量设置为:

     

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/SunJDK/jdk1.7.0_03/bin:/home/scs/apache-maven-3.0.4/bin"LANG="en_US.UTF-8"export JAVA_HOME=/usr/lib/jvm/SunJDK/jdk1.7.0_03#export JRE_HOME=/usr/lib/jvm/SunJDK/jdk1.7.0_03/jreexport CLASSPATH=$CLASSPATH:$JAVA_HOME/libexport M3_HOME=/home/scs/apache-maven-3.0.4export M3=$M3_HOME/bin


     注意:

             SSH设置时,别忘记
             $ git config --global user.name "Firstname Lastname"Sets the name of the user for all git instances on the system
             $ git config --global user.email "your_email@youremail.com"Sets the email of the user for all git instances on the system

     碰到的问题:

        

         1.   Linux下,生成javadoc时,出错,无法编译通过
           [ERROR] Failed to execute goal on project gameoflife-webservice: Could not resolve dependencies for project com.wakaleo.gameoflife:gameoflife-webservice:jar:0.8.30-SNAPSHOT: The repository system is offline but the artifact com.wakaleo.gameoflife:gameoflife-core:jar:0.8.30-SNAPSHOT is not available in the local repository. -> [Help 1]
          解决方案:jenkins系统配置时,maven的配置时,添加maven->去掉install的选择,弹出maven_home的选项,正确填写

      2. 为了控制jenkins的访问用户,预使用公司的active directory,但是却不成功,无法连接active directory服务器。 ping 服务器不通,但是nslook 服务器却是能够解析域名

          分析和解决方案:
        经查找发现,这是ubuntu 的Avahi服务造成的。      


AvahiAvahi 是Zeroconf规范的开源实现,常见使用在Linux上。包含了一整套多播DNS(multicastDNS)/DNS-SD网络服务的实现。它使用 的发布授权是LGPL。Zeroconf规范的另一个实现是Apple公司的Bonjour程式。Avahi和Bonjour相互兼容(废话,都走同一个 规范标准嘛,就象IE,Firefox,chrome都能跑HTTP1.1一样)。Avahi允许程序在不需要进行手动网络配置的情况 下,在一个本地网络中发布和获知各种服务和主机。例如,当某用户把他的计算机接入到某个局域网时,如果他的机器运行有Avahi服务,则Avahi程式自 动广播,从而发现网络中可用的打印机、共享文件和可相互聊天的其他用户。这有点象他正在接收局域网中的各种网络广告一样。

ZeroconfZero configuration networking(zeroconf)零配置网络服务规范,是一种用于自动生成可用IP地址的网络技术,不需要额外的手动配置和专属的配置服务器。“零 配置网络服务”的目标,是让非专业用户也能便捷的连接各种网络设备,例如计算机,打印机等。整个搭建网络的过程都是通过程式自动化实现。如果没有 zeroconf,用户必须手动配置一些服务,例如DHCP、DNS,计算机网络的其他设置等。这些对非技术用户和新用户们来说是很难的事情。Zeroconf规范的提出者是Apple公司.

Avahi在Linux下系统实际启动的进程名是avahi-daemon
除非你有兼容的设备或使用 zeroconf 协议的服务,否则应该关闭它。  

如果你用不到 把该服务直接关闭    
/etc/init.d/avahi-daemon stop 或者 service avahi-daemon  stop

原创粉丝点击