作者:as123466_866 | 来源:互联网 | 2023-10-15 19:10
JenkinsHudson是一套非常强大的自动化构建系统,其具有使用简单,对各种开发环境支持良好,正确地使用能解决研发过程管理中版本构建、发布的诸多问题。本文描述了笔者在使用过程中
注:本文并不是想要教大家如何搭建Jenkins或Hudson的自动化构建环境,其实我有意将我的搭建过程总结成一篇文章供大家参考,但有很多问题我也还在研究,待我研究明白后一并奉上,如果你也在学习的路上我们倒可以相互交流学习一下。
为了减少人工操作在版本构建和发布过程中的不确定性,最近团队一直寻找一种自动化的构建环境,由于目前的团队中无人有此方面经验,作为技术部门负责人只能自己操刀。经过一阵的选型后决定采用Hudson,主要原因是该构建框架可以很好地支持目前正在使用Team foundation server软件开发周期管理系统,能很好解决Android、JAVA WEB、.NET项目共存的问题,同时能很好地支持Nexus
Maven私服。
搭建过程非常顺利,一路下载、安装、运行都很顺利,代码正常签出,原以为编译也会一切顺利,可惜事与愿违,每一次执行构建都抛如下异常:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:158)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:98)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:64)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:287)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.NoClassDefFoundError: org/apache/maven/cli/MavenLoggerManager
at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:73)
... 17 more
Caused by: java.lang.ClassNotFoundException: org.apache.maven.cli.MavenLoggerManager
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
... 18 more
channel stopped
ERROR: Failed to parse POMs
hudson.util.IOException2: java.lang.reflect.InvocationTargetException
at hudson.maven.Maven3Builder.call(Maven3Builder.java:152)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:64)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:287)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.Exception: java.lang.reflect.InvocationTargetException
at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:161)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:98)
... 9 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:158)
... 10 more
Caused by: java.lang.NoClassDefFoundError: org/apache/maven/cli/MavenLoggerManager
at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:73)
... 17 more
Caused by: java.lang.ClassNotFoundException: org.apache.maven.cli.MavenLoggerManager
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
... 18 more
Finished: FAILURE
程序界有句名言叫外事不懂问GOOGLE,内事不懂问度娘,HUDSON这样一外外来物种还是找GOOGLE吧,好一顿找基本没有找到一点有用的东西,后来想可能是HUDSON的插件下载问题,又尝试了找插件下载,半天又过去了问题依旧。最后实在没办法了尝试将HUDSON 换成最新版本的JENKINS 1.556,我的神那,还是一样,无意中想是不是HUDSON/JENKINS与MAVEN
不兼容造成的,没办法只能再试试了。
我原来用的是Maven 3.1.1在网上下载了一个Maven 3.0.4,解压并修改Jenkins引用,嘿嘿问题竟然解决了。
之后又尝试了通过Jenkins调用MSBuild编译.NET项目,一切正常。
Jenkins/Hudson自动化构建有关Maven兼容问题处理,布布扣,bubuko.com