如何使用Jenkins-Continuos Integration创建Kony项目的构建



我在三天内尝试创建一个Kony项目的自动构建。我使用的是Mac操作系统。

当我做时

$ su jenkins
$ git clone git@gitserver:/git/myproject.git
$ cd myproject
$ ant main

通过这种方式,项目建设成功!!

但是,如果我试图配置Jenkins来做同样的工作,那就行不通了!!问题发生在ant main期间。

这是Jenkins日志:

+ ant main
ant main Buildfile: /Users/Shared/Jenkins/Home/jobs/myproject/workspace/myproject/build.xml
main:
     [echo] Looking for JAR antcontrib.jar at : /Users/Shared/Jenkins/Home/jobs/myproject/workspace/myproject/ant-contrib-0.6.jar
     [echo] Started script...
     [echo] Global properties file LOCATION: /Users/Shared/Jenkins/Home/jobs/myproject/workspace/myproject/global.properties
     [echo] Build properties file LOCATION: /Users/Shared/Jenkins/Home/jobs/myproject/workspace/myproject/build.properties
     [echo] WORKSPACE LOCATION: /Users/Shared/Jenkins/Home/jobs/myproject/workspace/
     [exec] _RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
     [exec] [09-12-2014 10:19:20]Executing build file: /Applications/Kony/Kony_Studio/configuration/org.eclipse.osgi/bundles/261/1/.cp//masterbuild.xml
     [exec] 
     [exec] commoninit:
     [exec] cmdl.getCommandline(): [Ljava.lang.String;@4c309d4d
     [exec] 
     [exec] ***********/bin/sh
     [exec] 
     [exec] ***********/c
     [exec] 
     [exec] ***********chmod 777 /Applications/Kony/Kony_Studio/configuration/org.eclipse.osgi/bundles/261/1/.cp//preview/node_mac/bin/node
     [exec] 
     [exec] ***********/bin/sh
     [exec] 
     [exec] ***********/c
     [exec] 
     [exec] ***********-c
     [exec] 
     [exec] midlog4jtarget:
     [exec]      [echo] Copying thinclient jar files to jetty lib
     [exec]      [copy] Copying 6 files to /Applications/Kony/Kony_Studio/configuration/org.eclipse.osgi/bundles/261/1/.cp/jettydeploy/lib
     [exec]      [echo] Copying thinclient jar files to jetty lib
     [exec]      [copy] Copying 1 file to /Applications/Kony/Kony_Studio/configuration/org.eclipse.osgi/bundles/261/1/.cp/jettydeploy/lib
     [exec]      [copy] Copying 1 file to /Users/Shared/Jenkins/Home/jobs/myproject/workspace/middleware/middleware-bootconfig/tc
     [exec] 2014-09-12 10:19:21.644::INFO:  Logging to STDERR via org.mortbay.log.StdErrLog
     [exec] ***WARNING: Display must be created on main thread due to Cocoa restrictions.
     [exec] [JETTY Server] HTTP  - started and listening on [8888]
     [exec] [JETTY Server] HTTPS - started and listening on [8443]
     [exec] log4j:WARN No appenders could be found for logger (Licensing).
     [exec] log4j:WARN Please initialize the log4j system properly.
     [exec] 
     [exec] version= 1.5
     [exec] 
     [exec] name= Android 1.5
     [exec] 
     [exec] version= 1.6
     [exec] 
     [exec] name= Android 1.6
     [exec] 
     [exec] version= 2.1
     [exec] 
     [exec] name= Android 2.1
     [exec] 
     [exec] version= 2.2
     [exec] 
     [exec] name= Android 2.2
     [exec] 
     [exec] version= 2.3.3
     [exec] 
     [exec] name= Android 2.3.3
     [exec] 
     [exec] version= 3.0
     [exec] 
     [exec] name= Android 3.0
     [exec] 
     [exec] version= 3.1
     [exec] 
     [exec] name= Android 3.1
     [exec] 
     [exec] version= 3.2
     [exec] 
     [exec] name= Android 3.2
     [exec] 
     [exec] version= 4.0
     [exec] 
     [exec] name= Android 4.0
     [exec] 
     [exec] version= 4.0.3
     [exec] 
     [exec] name= Android 4.0.3
     [exec] 
     [exec] version= 4.1.2
     [exec] 
     [exec] name= Android 4.1.2
     [exec] 
     [exec] version= 4.2.2
     [exec] 
     [exec] name= Android 4.2.2
     [exec] 
     [exec] version= 4.3
     [exec] 
     [exec] name= Android 4.3
     [exec] 
     [exec] version= 4.4.2
     [exec] 
     [exec] name= Android 4.4.2
     [exec] 
     [exec] version= 4.4W
     [exec] 
     [exec] name= Android 4.4W
     [exec] 
     [exec] version= 1.5
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 1.6
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 2.1
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 2.2
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 2.3.3
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 3.0
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 3.1
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 3.2
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 3.2
     [exec] 
     [exec] name= Google TV Addon
     [exec] 
     [exec] version= 4.0
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 4.0.3
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 4.1.2
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 4.2.2
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 4.3
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 4.4.2
     [exec] 
     [exec] name= Glass Development Kit Preview
     [exec] 
     [exec] version= 4.4.2
     [exec] 
     [exec] name= Google APIs
     [exec] 
     [exec] version= 4.4.2
     [exec] 
     [exec] name= Google APIs (x86 System Image)
     [exec] 
     [exec] Version=7
     [exec] 
     [exec] Version=8
     [exec] 
     [exec] Version=10
     [exec] 
     [exec] Version=11
     [exec] 
     [exec] Version=12
     [exec] 
     [exec] Version=13
     [exec] 
     [exec] Version=14
     [exec] 
     [exec] Version=15
     [exec] 
     [exec] Version=16
     [exec] 
     [exec] Version=17
     [exec] 
     [exec] Version=18
     [exec] 
     [exec] Version=19
     [exec] Time taken for populating SDK List: 3832
     [exec] Argument: /Users/Shared/Jenkins/Home/jobs/myproject/workspace/myproject/build.properties
     [exec] Workspace Loc: /Users/Shared/Jenkins/Home/jobs/myproject/workspace
     [exec] 
     [exec] [Jetty Server] Shutdown is successful
     [exec] An error has occurred. See the log file
     [exec] /Users/Shared/Jenkins/Home/jobs/myproject/workspace/.metadata/.log. BUILD FAILED /Users/Shared/Jenkins/Home/jobs/myproject/workspace/myproject/build.xml:123: exec returned: 13
Total time: 28 seconds Build step 'Execute shell' marked build as failure Finished: FAILURE

只记得,当我手动做同样的过程时,这个问题不会发生。文件:/Users/Shared/Jenkins/Home/jobs/myproject/workspace/.metadata/.log

!SESSION 2014-09-12 10:34:09.679 -----------------------------------------------
eclipse.buildId=M20130204-1200
java.version=1.8.0
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US
Framework arguments:  -application com.pat.tool.keditor.konyapplication
Command-line arguments:  -data /Users/Shared/Jenkins/Home/jobs/myproject/workspace/ -application com.pat.tool.keditor.konyapplication
This is a continuation of log file /Users/Shared/Jenkins/Home/jobs/myproject/workspace/.metadata/.bak_0.log
Created Time: 2014-09-12 10:34:23.895
!ENTRY org.eclipse.osgi 4 0 2014-09-12 10:34:23.895
!MESSAGE Application error
!STACK 1
java.lang.NoClassDefFoundError: org/eclipse/ui/actions/SelectionListenerAction
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClassHoldingLock(ClasspathManager.java:632)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:607)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:568)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:492)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:465)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
    at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:395)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:464)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at com.pat.tool.keditor.actions.ResourceActionHelper.runTasks(ResourceActionHelper.java:770)
    at com.pat.tool.keditor.actions.ResourceActionHelper.runTasks(ResourceActionHelper.java:516)
    at com.pat.tool.keditor.commandline.CommandLineApplication.start(CommandLineApplication.java:175)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
    at org.eclipse.core.launcher.Main.main(Main.java:34)
Caused by: org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter$TerminatingClassNotFoundException: An error occurred while automatically activating bundle org.eclipse.ui.ide (210).
    at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:122)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:469)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
    at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:395)
    at org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:35)
    at org.eclipse.osgi.internal.loader.MultiSourcePackage.loadClass(MultiSourcePackage.java:31)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:461)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 32 more
Caused by: org.osgi.framework.BundleException: Exception in org.eclipse.ui.internal.ide.IDEWorkbenchPlugin.start() of bundle org.eclipse.ui.ide.
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:734)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)
    at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:300)
    at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:440)
    at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:263)
    at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:107)
    ... 42 more
Caused by: java.lang.NullPointerException
    at org.eclipse.swt.graphics.Device.getPrimaryScreen(Device.java:348)
    at org.eclipse.swt.graphics.Device.getScreenDPI(Device.java:408)
    at org.eclipse.swt.graphics.Device.getDPI(Device.java:343)
    at org.eclipse.swt.graphics.Device.init(Device.java:542)
    at org.eclipse.swt.widgets.Display.init(Display.java:2132)
    at org.eclipse.swt.graphics.Device.<init>(Device.java:131)
    at org.eclipse.swt.widgets.Display.<init>(Display.java:701)
    at org.eclipse.swt.widgets.Display.<init>(Display.java:692)
    at org.eclipse.swt.widgets.Display.getDefault(Display.java:1388)
    at org.eclipse.ui.internal.ide.IDEWorkbenchPlugin.createProblemsViews(IDEWorkbenchPlugin.java:394)
    at org.eclipse.ui.internal.ide.IDEWorkbenchPlugin.start(IDEWorkbenchPlugin.java:351)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
    ... 48 more

问题似乎是:

     [exec] _RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.

您使用的某些工具想要创建窗口并在屏幕上绘制。如果使用标准安装程序安装Jenkins,则这是不可能的。Jenkins的Mac安装程序使其作为启动守护程序运行,这是一个无法访问图形系统的后台服务。

你有三个选择:

  • 检查是否有一种方法可以调用该工具,使其不需要在屏幕上绘制。也许有一个选项可以在"无头"模式下运行它
  • 如果这不可能,请为Jenkins设置一个JNLP类型的从机。然后从GUI控制台登录到Mac,并启动在会话中运行的从属程序。让自己登录
  • 或者,在GUI会话中运行Jenkins master。我有一个很好的前端/助手来做这件事:https://github.com/stisti/jenkins-app

相关内容

  • 没有找到相关文章

最新更新