1 [iyunv@CloudGame jenkins]# java -jar jenkins.war
2 Running from: /home/webWps/jenkins/jenkins.war
3 webroot: $user.home/.jenkins
4 Jan 20, 2016 1:57:50 PM winstone.Logger logInternal
5 INFO: Beginning extraction from war file
6 Jan 20, 2016 1:57:50 PM org.eclipse.jetty.util.log.JavaUtilLog info
7 INFO: jetty-winstone-2.9
8 Jan 20, 2016 1:57:51 PM org.eclipse.jetty.util.log.JavaUtilLog info
9 INFO: NO JSP Support for , did not find org.apache.jasper.servlet.JspServlet
10 Jenkins home directory: /root/.jenkins found at: $user.home/.jenkins
11 Jan 20, 2016 1:57:52 PM org.eclipse.jetty.util.log.JavaUtilLog info
12 INFO: Started SelectChannelConnector@0.0.0.0:8080
13 Jan 20, 2016 1:57:52 PM winstone.Logger logInternal
14 INFO: Winstone Servlet Engine v2.0 running: controlPort=disabled
15 Jan 20, 2016 1:57:52 PM jenkins.InitReactorRunner$1 onAttained
16 INFO: Started initialization
17 Jan 20, 2016 1:57:52 PM jenkins.InitReactorRunner$1 onAttained
18 INFO: Listed all plugins
19 Jan 20, 2016 1:57:53 PM jenkins.InitReactorRunner$1 onAttained
20 INFO: Prepared all plugins
21 Jan 20, 2016 1:57:53 PM jenkins.InitReactorRunner$1 onAttained
22 INFO: Started all plugins
23 Jan 20, 2016 1:57:53 PM jenkins.InitReactorRunner$1 onAttained
24 INFO: Augmented all extensions
25 Jan 20, 2016 1:57:58 PM jenkins.InitReactorRunner$1 onAttained
26 INFO: Loaded all jobs
27 Jan 20, 2016 1:57:58 PM hudson.model.AsyncPeriodicWork$1 run
28 INFO: Started Download metadata
29 Jan 20, 2016 1:57:58 PM hudson.model.AsyncPeriodicWork$1 run
30 INFO: Finished Download metadata. 2 ms
31 Jan 20, 2016 1:57:59 PM org.jenkinsci.main.modules.sshd.SSHD start
32 INFO: Started SSHD at port 34811
33 Jan 20, 2016 1:57:59 PM jenkins.InitReactorRunner$1 onAttained
34 INFO: Completed initialization
35 Jan 20, 2016 1:57:59 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
36 INFO: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@6ddaa30c: display name [Root WebApplicationContext]; startup date [Wed Jan 20 13:57:59 CST 2016]; root of context hierarchy
37 Jan 20, 2016 1:57:59 PM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
38 INFO: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@6ddaa30c]: org.springframework.beans.factory.support.DefaultListableBeanFactory@17cfc9f4
39 Jan 20, 2016 1:57:59 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
40 INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@17cfc9f4: defining beans [authenticationManager]; root of factory hierarchy
41 Jan 20, 2016 1:57:59 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
42 INFO: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@574f6e10: display name [Root WebApplicationContext]; startup date [Wed Jan 20 13:57:59 CST 2016]; root of context hierarchy
43 Jan 20, 2016 1:57:59 PM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
44 INFO: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@574f6e10]: org.springframework.beans.factory.support.DefaultListableBeanFactory@1006f1b7
45 Jan 20, 2016 1:57:59 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
46 INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1006f1b7: defining beans [filter,legacy]; root of factory hierarchy
47 Jan 20, 2016 1:57:59 PM jenkins.InitReactorRunner$1 onAttained
48 INFO: Started initialization
49 Jan 20, 2016 1:57:59 PM jenkins.InitReactorRunner$1 onAttained
50 INFO: Listed all plugins
51 Jan 20, 2016 1:57:59 PM jenkins.InitReactorRunner$1 onAttained
52 INFO: Prepared all plugins
53 Jan 20, 2016 1:57:59 PM jenkins.InitReactorRunner$1 onAttained
54 INFO: Started all plugins
55 Jan 20, 2016 1:57:59 PM jenkins.InitReactorRunner$1 onAttained
56 INFO: Augmented all extensions
57 Jan 20, 2016 1:57:59 PM jenkins.InitReactorRunner$1 onAttained
58 INFO: Loaded all jobs
59 Jan 20, 2016 1:57:59 PM jenkins.InitReactorRunner$1 onAttained
60 INFO: Completed initialization
61 Jan 20, 2016 1:57:59 PM hudson.WebAppMain$3 run
62 INFO: Jenkins is fully up and running
之所以可以直接java -jar jenkins.war运行,从这个启动日志中可以看到,是因为jenkins内部集成了jetty这个web服务程序,正如spring-boot的框架,默认集成Tomcat服务程序一样。
jenkins的启动后,默认http://localhost:8080就可以打开查看web UI了,易用就体现在所有的相关配置都在web ui上完成。免除对命令行不习惯的用户的烦恼,也不需要这里配置一点,哪里配置一点的脑裂痛苦。还有,也可以自己设置选定的端口号,这样就可以: java -jar jenkins.war --httpPort=8081 , jenkins有很多启动配置选项,可以通过--help查看:
1 [iyunv@CloudGame jenkins]# java -jar jenkins.war --help
2 Running from: /home/webWps/jenkins/jenkins.war
3 webroot: $user.home/.jenkins
4 Jenkins Continuous Integration Engine 1.644
5 Usage: java -jar jenkins.war [--option=value] [--option=value]
6
7 Options:
8 --extractedFilesFolder = folder where extracted files are to be located. Default is the temp folder
9 --daemon = fork into background and run as daemon (Unix only)
10 --config = load configuration properties from here. Default is ./winstone.properties
11 --prefix = add this prefix to all URLs (eg http://localhost:8080/prefix/resource). Default is none
12 --commonLibFolder = folder for additional jar files. Default is ./lib
13
14 --logfile = redirect log messages to this file
15 --logThrowingLineNo = show the line no that logged the message (slow). Default is false
16 --logThrowingThread = show the thread that logged the message. Default is false
17 --debug = set the level of debug msgs (1-9). Default is 5 (INFO level)
18
19 --httpPort = set the http listening port. -1 to disable, Default is 8080
20 --httpListenAddress = set the http listening address. Default is all interfaces
21 --httpDoHostnameLookups = enable host name lookups on incoming http connections (true/false). Default is false
22 --httpKeepAliveTimeout = how long idle HTTP keep-alive connections are kept around (in ms; default 5000)?
23 --httpsPort = set the https listening port. -1 to disable, Default is disabled
24 if neither --httpsCertificate nor --httpsKeyStore are specified,
25 https is run with one-time self-signed certificate.
26 --httpsListenAddress = set the https listening address. Default is all interfaces
27 --httpsDoHostnameLookups = enable host name lookups on incoming https connections (true/false). Default is false
28 --httpsKeepAliveTimeout = how long idle HTTPS keep-alive connections are kept around (in ms; default 5000)?
29 --httpsKeyStore = the location of the SSL KeyStore file.
30 --httpsKeyStorePassword = the password for the SSL KeyStore file. Default is null
31 --httpsCertificate = the location of the PEM-encoded SSL certificate file.
32 (the one that starts with '-----BEGIN CERTIFICATE-----')
33 must be used with --httpsPrivateKey.
34 --httpsPrivateKey = the location of the PEM-encoded SSL private key.
35 (the one that starts with '-----BEGIN RSA PRIVATE KEY-----')
36 --httpsKeyManagerType = the SSL KeyManagerFactory type (eg SunX509, IbmX509). Default is SunX509
37 --spdy = Enable SPDY. See http://wiki.eclipse.org/Jetty/Feature/NPN
38 --ajp13Port = set the ajp13 listening port. -1 to disable, Default is disabled
39 --ajp13ListenAddress = set the ajp13 listening address. Default is all interfaces
40 --controlPort = set the shutdown/control port. -1 to disable, Default disabled
41
42 --handlerCountStartup = set the no of worker threads to spawn at startup. Default is 5
43 --handlerCountMax = set the max no of worker threads to allow. Default is 40
44 --handlerCountMaxIdle = set the max no of idle worker threads to allow. Default is 5
45
46 --sessionTimeout = set the http session timeout value in minutes. Default to what webapp specifies, and then to 60 minutes
47 --mimeTypes=ARG = define additional MIME type mappings. ARG would be EXT=MIMETYPE:EXT=MIMETYPE:...
48 (e.g., xls=application/vnd.ms-excel:wmf=application/x-msmetafile)
49 --maxParamCount=N = set the max number of parameters allowed in a form submission to protect
50 against hash DoS attack (oCERT #2011-003). Default is 10000.
51 --usage / --help = show this message
52 --version = show the version and quit
53
54 Security options:
55 --realmClassName = Set the realm class to use for user authentication. Defaults to ArgumentsRealm class
56
57 --argumentsRealm.passwd.<user> = Password for user <user>. Only valid for the ArgumentsRealm realm class
58 --argumentsRealm.roles.<user> = Roles for user <user> (comma separated). Only valid for the ArgumentsRealm realm class
59
60 --fileRealm.configFile = File containing users/passwds/roles. Only valid for the FileRealm realm class
61
62 Access logging:
63 --accessLoggerClassName = Set the access logger class to use for user authentication. Defaults to disabled
64 --simpleAccessLogger.format = The log format to use. Supports combined/common/resin/custom (SimpleAccessLogger only)
65 --simpleAccessLogger.file = The location pattern for the log file(SimpleAccessLogger only)
View Code 下面,打开浏览器看看效果吧:
除了上面红色的框,发现没,maven的集成插件也有,若没有,也需要自己安装maven插件的。再说说这个绿色的框,里面有的后面有Downgrade信息的按钮,这个是针对插件更新用的,这个更新是向低版本更新哟。
需要的插件安装完了,那么,就要说说系统环境配置了。如下图所示,也很容易找到Jenkins>Manage jenkins>Configure System
点击schedule右边的问号按钮,有详细的帮助信息。我这里贴一个简单的规则描述,方便理解上面配置当中各个数字的含义以及可能都有什么配置。
This field follows the syntax of cron (with minor differences). Specifically, each line consists of 5 fields separated by TAB or whitespace:
MINUTE HOUR DOM MONTH DOW
MINUTE Minutes within the hour (0–59)
HOUR The hour of the day (0–23)
DOM The day of the month (1–31)
MONTH The month (1–12)
DOW The day of the week (0–7) where 0 and 7 are Sunday.
最后的配置,就是想做什么的事情。我希望让其打包,并且不需要执行unit test工作,就是红色框中的内容。注意,这里要填写的是Goals (以及选项,当然选项可以没有),不要带上mvn指令,否则会出错的哟。(错误信息主体为:You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id> 。。。。)
1 Failed to send out e-mail
2
3 javax.mail.MessagingException: Could not connect to SMTP host: smtp.163.com, port: 25;
4 nested exception is:
5 java.net.NoRouteToHostException: No route to host
6 at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1934)
7 at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:638)
8 at javax.mail.Service.connect(Service.java:295)
9 at javax.mail.Service.connect(Service.java:176)
10 at javax.mail.Service.connect(Service.java:125)
11 at javax.mail.Transport.send0(Transport.java:194)
12 at javax.mail.Transport.send(Transport.java:124)
13 at hudson.tasks.Mailer$DescriptorImpl.doSendTestMail(Mailer.java:566)
14 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
15 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
16 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
17 at java.lang.reflect.Method.invoke(Method.java:497)
18 at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:298)
19 at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:161)
20 at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:96)
21 at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:121)
22 at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
23 at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
24 at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
25 at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:249)
26 at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
27 at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
28 at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
29 at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
30 at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
31 at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
32 at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)
33 at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1494)
34 at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132)
35 at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:123)
36 at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
37 at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:49)
38 at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
39 at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
40 at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
41 at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
42 at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
43 at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
44 at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
45 at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
46 at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
47 at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
48 at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
49 at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
50 at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
51 at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
52 at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
53 at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
54 at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
55 at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
56 at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
57 at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
58 at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
59 at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
60 at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
61 at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
62 at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
63 at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1474)
64 at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499)
65 at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
66 at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:533)
67 at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
68 at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
69 at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
70 at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
71 at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
72 at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
73 at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
74 at org.eclipse.jetty.server.Server.handle(Server.java:370)
75 at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
76 at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:960)
77 at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1021)
78 at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
79 at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
80 at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
81 at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
82 at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
83 at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
84 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
85 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
86 at java.lang.Thread.run(Thread.java:745)
87 Caused by: java.net.NoRouteToHostException: No route to host
88 at java.net.PlainSocketImpl.socketConnect(Native Method)
89 at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
90 at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
91 at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
92 at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
93 at java.net.Socket.connect(Socket.java:589)
94 at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:286)
95 at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:231)
96 at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1900)
97 ... 80 more
View Code 到此,一个基本的job就算配置完毕了,下面看看job配置完成后是什么样子呢?