Jenkins在OSX上构建失败

时间:2013-07-12 16:41:58

标签: maven-2 jenkins

我正在尝试使用Jenkins构建我的项目,以将工件部署到nexus。我的macOSX上有一个Jenkins设置。 下面是错误,我得到了:

解析POM

  

[maventest] $   /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java   -Xmx512m -XX:MaxPermSize = 128m -Dfile.encoding = UTF-8 -cp /Users/Shared/Jenkins/Home/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.3.jar:/usr/分享/行家的/ boot /丛,classworlds-2.4.jar   org.jvnet.hudson.maven3.agent.Maven3Main / usr / share / maven   /Users/Shared/Jenkins/Home/war/WEB-INF/lib/remoting-2.26.jar   /Users/Shared/Jenkins/Home/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.3.jar   59985

< === [JENKINS REMOTING CAPACITY] ===>频道开始

频道已停止

  

错误:无法解析POM java.io.IOException:远程调用   通往Maven的频道   [/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java,   -Xmx512m,-XX:MaxPermSize = 128m,-Dfile.encoding = UTF-8,-cp,/ Users / Shared / Jenkins / Home /plugins / maven-plugin / WEB-INF / lib / maven3-agent-1.3.jar :/usr/share/maven/boot/plexus-classworlds-2.4.jar,   org.jvnet.hudson.maven3.agent.Maven3Main,/ usr / share / maven,   /Users/Shared/Jenkins/Home/war/WEB-INF/lib/remoting-2.26.jar,   /Users/Shared/Jenkins/Home/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.3.jar,   59985]在hudson.remoting.Channel.call(Channel.java:727)失败了   hudson.maven.ProcessCache $ MavenProcess.call(ProcessCache.java:156)at at   hudson.maven.MavenModuleSetBuild $ MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:770)     在   hudson.model.AbstractBuild $ AbstractBuildExecution.run(AbstractBuild.java:586)     在hudson.model.Run.execute(Run.java:1593)at   hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:491)at at   hudson.model.ResourceController.execute(ResourceController.java:88)     在hudson.model.Executor.run(Executor.java:247)引起:   java.lang.InternalError:无法连接到窗口服务器 - 还不够   权限。 at java.lang.ClassLoader $ NativeLibrary.load(Native   方法)在java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1827)     在java.lang.ClassLoader.loadLibrary(ClassLoader.java:1724)at   java.lang.Runtime.loadLibrary0(Runtime.java:823)at   java.lang.System.loadLibrary(System.java:1045)at   sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)     在java.security.AccessController.doPrivileged(Native Method)at   java.awt.Toolkit.loadLibraries(Toolkit.java:1605)at   java.awt.Toolkit。(Toolkit.java:1627)at   java.awt.Color。(Color.java:263)at   hudson.util.ColorPalette。(ColorPalette.java:39)at   hudson.model.BallColor。(BallColor.java:56)at   hudson.model.Result。(Result.java:51)at   java.lang.Class.forName0(Native Method)at   java.lang.Class.forName(Class.java:171)at   com.sun.proxy。$ Proxy8。(未知来源)at   sun.reflect.GeneratedSerializationConstructorAccessor41.newInstance(未知   来源)at   java.lang.reflect.Constructor.newInstance(Constructor.java:513)at   java.io.ObjectStreamClass.newInstance(ObjectStreamClass.java:929)at   java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1759)     at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1327)     在   java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1969)     在   java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1893)     在   java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1775)     at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1327)     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:349)     在java.util.HashMap.readObject(HashMap.java:1030)at   sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)     在   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)     在java.lang.reflect.Method.invoke(Method.java:597)at   java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:979)     在   java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)     在   java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1775)     at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1327)     在   java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1969)     在   java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1893)     在   java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1775)     at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1327)     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:349)     在hudson.remoting.UserRequest.deserialize(UserRequest.java:182)at at   hudson.remoting.UserRequest.perform(UserRequest.java:98)at   hudson.remoting.UserRequest.perform(UserRequest.java:48)at   hudson.remoting.Request $ 2.run(Request.java:326)at   hudson.remoting.InterceptingExecutorService $ 1.call(InterceptingExecutorService.java:72)     at java.util.concurrent.FutureTask $ Sync.innerRun(FutureTask.java:303)     在java.util.concurrent.FutureTask.run(FutureTask.java:138)at   java.util.concurrent.ThreadPoolExecutor中的$ Worker.runTask(ThreadPoolExecutor.java:895)     在   java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:918)     在java.lang.Thread.run(Thread.java:680)完成:失败

我已经尝试过以下解决方案,但它没有工作: http://jenkins-ci.361315.n4.nabble.com/JIRA-Created-HUDSON-5584-java-io-IOException-Remote-call-on-Channel-to-Maven-td1475049.html

我的配置:

MAVEN_OPTS:-Xmx1024m -XX:MaxPermSize=128m -Dfile.encoding=UTF-8 -Djava.awt.headless=true

输出ps -ef | grep java:/usr/bin/java -Djava.awt.headless=true -jar /Applications/Jenkins/jenkins.war

构建命令:clean deploy -DaltDeploymentRepository=central::default::http://<user>:<pwd>@<host>:<port>/nexus/content/groups/public/

2 个答案:

答案 0 :(得分:2)

我使用的解决方案是应用Java 7.您要做的是向Jenkins添加1.7。按照这些步骤,我能够成功构建我的项目:

  1. 转到Oracle Java页面并下载适用于Mac的1.7_51 jdk。
  2. 打开dmg并运行可执行文件。
  3. 在Mac上,这会将JDK安装到/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk /
  4. 在詹金斯,转到'管理詹金斯'&gt; '配置系统'
  5. 在JDK标题下,单击“JDK Installations”按钮
  6. 在名称类型'JDK 1.7.0_51'
  7. 对于JAVA_HOME类型'/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home /'
  8. 选择保存
  9. 转到您的项目并选择配置
  10. 您现在应该在页面顶部附近有一个JDK下拉列表。
  11. 选择刚刚在“管理Jenkins”
  12. 下配置的JDK
  13. 运行构建
  14. 执行此操作后,我的构建成功运行时没有“无法连接到窗口服务器 - 没有足够的权限错误。”

答案 1 :(得分:0)

这条线看起来好奇:

hudson.model.Executor.run(Executor.java:247) Caused by: java.lang.InternalError:
Can't connect to window server - not enough permissions. at java.lang.ClassLoader
$NativeLibrary.load(Native Method) 

我将从一个更简单的项目开始,然后从那一点开始增加复杂性,因为我们只是进行测试以确保您的基本假设是正确的。

您可能需要设置JVM属性:-Djava.awt.headless=true。通过这样做,您将禁用尝试加载的(最可能不必要的)gui库。