jenkins自动化部署

  • 下载jenkins:https://jenkins.io/download/ 。下载的是jenkins.war。
  • Linux环境:Jdk1.8,Tomcat8。(查看JDK版本:java -version)。
  • 将下载的jenkins.war包放到Tomcat的webapps下然后启动Tomcat,完成jenkins启动。官方推荐使用:

jenkins自动化部署_第1张图片

  • 新建一个jenkins文件夹,将jenkins.war包放到这个新建的文件夹下面,在这个文件夹中使用:java -jar jenkins.war --httpPort=8080  命令启动jenkins。
  • 启动报错:
    19-Sep-2019 14:25:08.044 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.0.43
    19-Sep-2019 14:25:08.051 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Mar 28 2017 14:42:59 UTC
    19-Sep-2019 14:25:08.051 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.0.43.0
    19-Sep-2019 14:25:08.051 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Linux
    19-Sep-2019 14:25:08.051 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            5.2.15
    19-Sep-2019 14:25:08.051 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
    19-Sep-2019 14:25:08.052 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /usr/java/jdk1.8.0_45/jre
    19-Sep-2019 14:25:08.052 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_45-b14
    19-Sep-2019 14:25:08.052 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
    19-Sep-2019 14:25:08.052 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /home/tomcat
    19-Sep-2019 14:25:08.052 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /home/tomcat
    19-Sep-2019 14:25:08.052 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/home/tomcat/conf/logging.properties
    19-Sep-2019 14:25:08.052 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
    19-Sep-2019 14:25:08.052 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
    19-Sep-2019 14:25:08.052 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
    19-Sep-2019 14:25:08.053 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=/home/tomcat/endorsed
    19-Sep-2019 14:25:08.053 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/home/tomcat
    19-Sep-2019 14:25:08.053 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/home/tomcat
    19-Sep-2019 14:25:08.053 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/home/tomcat/temp
    19-Sep-2019 14:25:08.053 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
    19-Sep-2019 14:25:08.372 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
    19-Sep-2019 14:25:08.402 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
    19-Sep-2019 14:25:08.409 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
    19-Sep-2019 14:25:08.411 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
    19-Sep-2019 14:25:08.415 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1158 ms
    19-Sep-2019 14:25:08.471 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
    19-Sep-2019 14:25:08.474 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.43
    19-Sep-2019 14:25:08.509 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /home/tomcat/webapps/jenkins.war
    19-Sep-2019 14:25:25.480 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
    Jenkins home directory: /root/.jenkins found at: $user.home/.jenkins
    19-Sep-2019 14:25:26.376 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /home/tomcat/webapps/jenkins.war has finished in 17,858 ms
    19-Sep-2019 14:25:26.393 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
    19-Sep-2019 14:25:26.411 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
    19-Sep-2019 14:25:26.436 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 18021 ms
    19-Sep-2019 14:25:27.075 INFO [pool-6-thread-2] jenkins.InitReactorRunner$1.onAttained Started initialization
    19-Sep-2019 14:25:27.089 INFO [pool-6-thread-2] jenkins.InitReactorRunner$1.onAttained Listed all plugins
    19-Sep-2019 14:25:29.765 INFO [pool-6-thread-1] jenkins.InitReactorRunner$1.onAttained Prepared all plugins
    19-Sep-2019 14:25:29.766 INFO [pool-6-thread-1] jenkins.InitReactorRunner$1.onAttained Started all plugins
    19-Sep-2019 14:25:29.780 INFO [pool-6-thread-2] jenkins.InitReactorRunner$1.onAttained Augmented all extensions
    19-Sep-2019 14:25:29.818 WARNING [UpdateCenter.init] hudson.model.UpdateCenter.load Failed to load /root/.jenkins/hudson.model.UpdateCenter.xml
     java.io.IOException: Unable to read /root/.jenkins/hudson.model.UpdateCenter.xml
        at hudson.XmlFile.unmarshal(XmlFile.java:165)
        at hudson.model.UpdateCenter.load(UpdateCenter.java:775)
        at hudson.model.UpdateCenter.init(UpdateCenter.java:2035)
        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:497)
        at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104)
        at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
        at jenkins.model.Jenkins$7.runTask(Jenkins.java:996)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: com.thoughtworks.xstream.io.StreamException:  : only 1.0 is supported as )
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.readRealEvent(AbstractPullReader.java:148)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.readEvent(AbstractPullReader.java:141)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.move(AbstractPullReader.java:118)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.moveDown(AbstractPullReader.java:103)
        at com.thoughtworks.xstream.io.xml.XppReader.(XppReader.java:63)
        at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:54)
        at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:65)
        at hudson.XmlFile.unmarshal(XmlFile.java:163)
        ... 15 more
    Caused by: org.xmlpull.v1.XmlPullParserException: only 1.0 is supported as )
        at org.xmlpull.mxp1.MXParser.parseXmlDecl(MXParser.java:2592)
        at org.xmlpull.mxp1.MXParser.parsePI(MXParser.java:2466)
        at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1447)
        at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1395)
        at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
        at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:109)
        ... 23 more
    
    19-Sep-2019 14:25:29.820 SEVERE [pool-6-thread-1] jenkins.InitReactorRunner$1.onTaskFailed Failed Loading global config
     java.io.IOException: Unable to read /root/.jenkins/config.xml
        at hudson.XmlFile.unmarshal(XmlFile.java:165)
        at jenkins.model.Jenkins.loadConfig(Jenkins.java:2783)
        at jenkins.model.Jenkins.access$700(Jenkins.java:321)
        at jenkins.model.Jenkins$16.run(Jenkins.java:2801)
        at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
        at jenkins.model.Jenkins$7.runTask(Jenkins.java:996)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: com.thoughtworks.xstream.io.StreamException:  : only 1.0 is supported as )
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.readRealEvent(AbstractPullReader.java:148)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.readEvent(AbstractPullReader.java:141)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.move(AbstractPullReader.java:118)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.moveDown(AbstractPullReader.java:103)
        at com.thoughtworks.xstream.io.xml.XppReader.(XppReader.java:63)
        at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:54)
        at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:65)
        at hudson.XmlFile.unmarshal(XmlFile.java:163)
        ... 11 more
    Caused by: org.xmlpull.v1.XmlPullParserException: only 1.0 is supported as )
        at org.xmlpull.mxp1.MXParser.parseXmlDecl(MXParser.java:2592)
        at org.xmlpull.mxp1.MXParser.parsePI(MXParser.java:2466)
        at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1447)
        at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1395)
        at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
        at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:109)
        ... 19 more
    
    19-Sep-2019 14:25:29.845 SEVERE [Jenkins initialization thread] hudson.util.BootFailure.publish Failed to initialize Jenkins
     hudson.util.HudsonFailedToLoad: org.jvnet.hudson.reactor.ReactorException: java.io.IOException: Unable to read /root/.jenkins/config.xml
        at hudson.WebAppMain$3.run(WebAppMain.java:243)
    Caused by: org.jvnet.hudson.reactor.ReactorException: java.io.IOException: Unable to read /root/.jenkins/config.xml
        at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:269)
        at jenkins.InitReactorRunner.run(InitReactorRunner.java:44)
        at jenkins.model.Jenkins.executeReactor(Jenkins.java:1007)
        at jenkins.model.Jenkins.(Jenkins.java:867)
        at hudson.model.Hudson.(Hudson.java:85)
        at hudson.model.Hudson.(Hudson.java:81)
        at hudson.WebAppMain$3.run(WebAppMain.java:226)
    Caused by: java.io.IOException: Unable to read /root/.jenkins/config.xml
        at hudson.XmlFile.unmarshal(XmlFile.java:165)
        at jenkins.model.Jenkins.loadConfig(Jenkins.java:2783)
        at jenkins.model.Jenkins.access$700(Jenkins.java:321)
        at jenkins.model.Jenkins$16.run(Jenkins.java:2801)
        at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
        at jenkins.model.Jenkins$7.runTask(Jenkins.java:996)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: com.thoughtworks.xstream.io.StreamException:  : only 1.0 is supported as )
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.readRealEvent(AbstractPullReader.java:148)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.readEvent(AbstractPullReader.java:141)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.move(AbstractPullReader.java:118)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.moveDown(AbstractPullReader.java:103)
        at com.thoughtworks.xstream.io.xml.XppReader.(XppReader.java:63)
        at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:54)
        at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:65)
        at hudson.XmlFile.unmarshal(XmlFile.java:163)
        ... 11 more
    Caused by: org.xmlpull.v1.XmlPullParserException: only 1.0 is supported as )
        at org.xmlpull.mxp1.MXParser.parseXmlDecl(MXParser.java:2592)
        at org.xmlpull.mxp1.MXParser.parsePI(MXParser.java:2466)
        at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1447)
        at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1395)
        at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
        at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:109)
        ... 19 more
    
    19-Sep-2019 14:25:30.503 INFO [Jenkins initialization thread] jenkins.model.Jenkins.cleanUp Stopping Jenkins
    19-Sep-2019 14:25:30.922 WARNING [NullIdDescriptorMonitor.verify] hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.error Failed to instantiate Key[type=org.jenkinsci.main.modules.instance_identity.PageDecoratorImpl, annotation=[none]]; skipping this component
     com.google.inject.ProvisionException: Guice provision errors:
    
    1) Error injecting constructor, java.lang.ClassCastException: org.bouncycastle.asn1.pkcs.PrivateKeyInfo cannot be cast to org.bouncycastle.openssl.PEMKeyPair
      at org.jenkinsci.main.modules.instance_identity.PageDecoratorImpl.(PageDecoratorImpl.java:20)
    
    1 error
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:52)
        at com.google.inject.Scopes$1$1.get(Scopes.java:65)
        at hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.get(ExtensionFinder.java:424)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:1005)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1051)
        at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:1001)
        at hudson.ExtensionFinder$GuiceFinder._find(ExtensionFinder.java:386)
        at hudson.ExtensionFinder$GuiceFinder.find(ExtensionFinder.java:377)
        at hudson.ClassicPluginStrategy.findComponents(ClassicPluginStrategy.java:470)
        at hudson.ExtensionList.load(ExtensionList.java:349)
        at hudson.ExtensionList.ensureLoaded(ExtensionList.java:287)
        at hudson.ExtensionList.iterator(ExtensionList.java:156)
        at hudson.diagnosis.NullIdDescriptorMonitor.verify(NullIdDescriptorMonitor.java:67)
        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:497)
        at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104)
        at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
        at jenkins.model.Jenkins$7.runTask(Jenkins.java:996)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.ClassCastException: org.bouncycastle.asn1.pkcs.PrivateKeyInfo cannot be cast to org.bouncycastle.openssl.PEMKeyPair
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.read(InstanceIdentity.java:89)
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.(InstanceIdentity.java:62)
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.(InstanceIdentity.java:43)
        at org.jenkinsci.main.modules.instance_identity.PageDecoratorImpl.(PageDecoratorImpl.java:21)
        at org.jenkinsci.main.modules.instance_identity.PageDecoratorImpl$$FastClassByGuice$$68618106.newInstance()
        at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)
        at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:61)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:108)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:88)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1058)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        ... 26 more
    
    19-Sep-2019 14:25:31.184 WARNING [NullIdDescriptorMonitor.verify] hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.error Failed to instantiate Key[type=org.jenkinsci.main.modules.sshd.SSHD, annotation=[none]]; skipping this component
     com.google.inject.ProvisionException: Guice provision errors:
    
    1) Error injecting constructor, java.lang.ClassCastException: org.bouncycastle.asn1.pkcs.PrivateKeyInfo cannot be cast to org.bouncycastle.openssl.PEMKeyPair
      at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.(InstanceIdentity.java:43)
      while locating org.jenkinsci.main.modules.instance_identity.InstanceIdentity
        for field at org.jenkinsci.main.modules.sshd.SSHD.identity(SSHD.java:33)
    
    1 error
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:52)
        at com.google.inject.Scopes$1$1.get(Scopes.java:65)
        at hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.get(ExtensionFinder.java:424)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:54)
        at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:132)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:117)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:88)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1058)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        at com.google.inject.Scopes$1$1.get(Scopes.java:65)
        at hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.get(ExtensionFinder.java:424)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:1005)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1051)
        at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:1001)
        at hudson.ExtensionFinder$GuiceFinder._find(ExtensionFinder.java:386)
        at hudson.ExtensionFinder$GuiceFinder.find(ExtensionFinder.java:377)
        at hudson.ClassicPluginStrategy.findComponents(ClassicPluginStrategy.java:470)
        at hudson.ExtensionList.load(ExtensionList.java:349)
        at hudson.ExtensionList.ensureLoaded(ExtensionList.java:287)
        at hudson.ExtensionList.iterator(ExtensionList.java:156)
        at hudson.diagnosis.NullIdDescriptorMonitor.verify(NullIdDescriptorMonitor.java:67)
        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:497)
        at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104)
        at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
        at jenkins.model.Jenkins$7.runTask(Jenkins.java:996)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.ClassCastException: org.bouncycastle.asn1.pkcs.PrivateKeyInfo cannot be cast to org.bouncycastle.openssl.PEMKeyPair
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.read(InstanceIdentity.java:89)
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.(InstanceIdentity.java:62)
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.(InstanceIdentity.java:43)
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity$$FastClassByGuice$$af33f6d9.newInstance()
        at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)
        at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:61)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:108)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:88)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
        at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:54)
        at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:132)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:117)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:88)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1058)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        ... 37 more
    
    19-Sep-2019 14:25:31.187 WARNING [NullIdDescriptorMonitor.verify] hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.error Failed to instantiate Key[type=org.jenkinsci.main.modules.sshd.PortAdvertiser, annotation=[none]]; skipping this component
     com.google.inject.ProvisionException: Guice provision errors:
    
    1) null returned by binding at hudson.ExtensionFinder$GuiceFinder$SezpozModule.configure(ExtensionFinder.java:508)
     but org.jenkinsci.main.modules.sshd.PortAdvertiser.sshd is not @Nullable
      while locating org.jenkinsci.main.modules.sshd.SSHD
        for field at org.jenkinsci.main.modules.sshd.PortAdvertiser.sshd(PortAdvertiser.java:18)
    
    1 error
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:52)
        at com.google.inject.Scopes$1$1.get(Scopes.java:65)
        at hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.get(ExtensionFinder.java:424)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:1005)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1051)
        at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:1001)
        at hudson.ExtensionFinder$GuiceFinder._find(ExtensionFinder.java:386)
        at hudson.ExtensionFinder$GuiceFinder.find(ExtensionFinder.java:377)
        at hudson.ClassicPluginStrategy.findComponents(ClassicPluginStrategy.java:470)
        at hudson.ExtensionList.load(ExtensionList.java:349)
        at hudson.ExtensionList.ensureLoaded(ExtensionList.java:287)
        at hudson.ExtensionList.iterator(ExtensionList.java:156)
        at hudson.diagnosis.NullIdDescriptorMonitor.verify(NullIdDescriptorMonitor.java:67)
        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:497)
        at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104)
        at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
        at jenkins.model.Jenkins$7.runTask(Jenkins.java:996)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    
    19-Sep-2019 14:25:31.200 WARNING [NullIdDescriptorMonitor.verify] hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.error Failed to instantiate Key[type=org.jenkinsci.main.modules.sshd.SSHD, annotation=[none]]; skipping this component
     com.google.inject.ProvisionException: Guice provision errors:
    
    1) Error injecting constructor, java.lang.ClassCastException: org.bouncycastle.asn1.pkcs.PrivateKeyInfo cannot be cast to org.bouncycastle.openssl.PEMKeyPair
      at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.(InstanceIdentity.java:43)
      while locating org.jenkinsci.main.modules.instance_identity.InstanceIdentity
        for field at org.jenkinsci.main.modules.sshd.SSHD.identity(SSHD.java:33)
    
    1 error
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:52)
        at com.google.inject.Scopes$1$1.get(Scopes.java:65)
        at hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.get(ExtensionFinder.java:424)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:1005)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1051)
        at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:1001)
        at hudson.ExtensionFinder$GuiceFinder._find(ExtensionFinder.java:386)
        at hudson.ExtensionFinder$GuiceFinder.find(ExtensionFinder.java:377)
        at hudson.ClassicPluginStrategy.findComponents(ClassicPluginStrategy.java:470)
        at hudson.ExtensionList.load(ExtensionList.java:349)
        at hudson.ExtensionList.ensureLoaded(ExtensionList.java:287)
        at hudson.ExtensionList.iterator(ExtensionList.java:156)
        at hudson.diagnosis.NullIdDescriptorMonitor.verify(NullIdDescriptorMonitor.java:67)
        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:497)
        at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104)
        at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
        at jenkins.model.Jenkins$7.runTask(Jenkins.java:996)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.ClassCastException: org.bouncycastle.asn1.pkcs.PrivateKeyInfo cannot be cast to org.bouncycastle.openssl.PEMKeyPair
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.read(InstanceIdentity.java:89)
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.(InstanceIdentity.java:62)
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.(InstanceIdentity.java:43)
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity$$FastClassByGuice$$af33f6d9.newInstance()
        at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)
        at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:61)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:108)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:88)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
        at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:54)
        at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:132)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:117)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:88)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1058)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        ... 26 more
    
    19-Sep-2019 14:25:31.277 WARNING [Jenkins initialization thread] hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.error Failed to instantiate Key[type=org.jenkinsci.main.modules.sshd.SSHD, annotation=[none]]; skipping this component
     com.google.inject.ProvisionException: Guice provision errors:
    
    1) Error injecting constructor, java.lang.ClassCastException: org.bouncycastle.asn1.pkcs.PrivateKeyInfo cannot be cast to org.bouncycastle.openssl.PEMKeyPair
      at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.(InstanceIdentity.java:43)
      while locating org.jenkinsci.main.modules.instance_identity.InstanceIdentity
        for field at org.jenkinsci.main.modules.sshd.SSHD.identity(SSHD.java:33)
    
    1 error
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:52)
        at com.google.inject.Scopes$1$1.get(Scopes.java:65)
        at hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.get(ExtensionFinder.java:424)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:54)
        at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:132)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:117)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:88)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1058)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        at com.google.inject.Scopes$1$1.get(Scopes.java:65)
        at hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.get(ExtensionFinder.java:424)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:1005)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1051)
        at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:1001)
        at hudson.ExtensionFinder$GuiceFinder._find(ExtensionFinder.java:386)
        at hudson.ExtensionFinder$GuiceFinder.find(ExtensionFinder.java:377)
        at hudson.ClassicPluginStrategy.findComponents(ClassicPluginStrategy.java:470)
        at hudson.ExtensionList.load(ExtensionList.java:349)
        at hudson.ExtensionList.ensureLoaded(ExtensionList.java:287)
        at hudson.ExtensionList.iterator(ExtensionList.java:156)
        at jenkins.model.Jenkins.fireBeforeShutdown(Jenkins.java:2993)
        at jenkins.model.Jenkins.cleanUp(Jenkins.java:2934)
        at hudson.WebAppMain$3.run(WebAppMain.java:247)
    Caused by: java.lang.ClassCastException: org.bouncycastle.asn1.pkcs.PrivateKeyInfo cannot be cast to org.bouncycastle.openssl.PEMKeyPair
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.read(InstanceIdentity.java:89)
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.(InstanceIdentity.java:62)
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.(InstanceIdentity.java:43)
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity$$FastClassByGuice$$af33f6d9.newInstance()
        at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)
        at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:61)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:108)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:88)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
        at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:54)
        at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:132)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:117)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:88)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1058)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        ... 26 more
    
    19-Sep-2019 14:25:31.277 WARNING [Jenkins initialization thread] hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.error Failed to instantiate Key[type=org.jenkinsci.main.modules.sshd.ItemListenerImpl, annotation=[none]]; skipping this component
     com.google.inject.ProvisionException: Guice provision errors:
    
    1) null returned by binding at hudson.ExtensionFinder$GuiceFinder$SezpozModule.configure(ExtensionFinder.java:508)
     but org.jenkinsci.main.modules.sshd.ItemListenerImpl.sshd is not @Nullable
      while locating org.jenkinsci.main.modules.sshd.SSHD
        for field at org.jenkinsci.main.modules.sshd.ItemListenerImpl.sshd(ItemListenerImpl.java:14)
    
    1 error
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:52)
        at com.google.inject.Scopes$1$1.get(Scopes.java:65)
        at hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.get(ExtensionFinder.java:424)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:1005)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1051)
        at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:1001)
        at hudson.ExtensionFinder$GuiceFinder._find(ExtensionFinder.java:386)
        at hudson.ExtensionFinder$GuiceFinder.find(ExtensionFinder.java:377)
        at hudson.ClassicPluginStrategy.findComponents(ClassicPluginStrategy.java:470)
        at hudson.ExtensionList.load(ExtensionList.java:349)
        at hudson.ExtensionList.ensureLoaded(ExtensionList.java:287)
        at hudson.ExtensionList.iterator(ExtensionList.java:156)
        at jenkins.model.Jenkins.fireBeforeShutdown(Jenkins.java:2993)
        at jenkins.model.Jenkins.cleanUp(Jenkins.java:2934)
        at hudson.WebAppMain$3.run(WebAppMain.java:247)
    
    19-Sep-2019 14:25:31.289 INFO [Jenkins initialization thread] jenkins.model.Jenkins$21.onAttained Started termination
    19-Sep-2019 14:25:31.309 INFO [Jenkins initialization thread] jenkins.model.Jenkins$21.onAttained Completed termination
    19-Sep-2019 14:25:31.309 INFO [Jenkins initialization thread] jenkins.model.Jenkins._cleanUpDisconnectComputers Starting node disconnection
    19-Sep-2019 14:25:31.323 INFO [Jenkins initialization thread] jenkins.model.Jenkins._cleanUpShutdownPluginManager Stopping plugin manager
    19-Sep-2019 14:25:31.323 INFO [Jenkins initialization thread] jenkins.model.Jenkins._cleanUpPersistQueue Persisting build queue
    19-Sep-2019 14:25:31.552 INFO [Jenkins initialization thread] jenkins.model.Jenkins.cleanUp Jenkins stopped
    View Code

    删掉:/root/.jenkins 目录。再启动试下。

  • 网页上输入:ip地址+端口号。访问jenkins,展示如下图。

jenkins自动化部署_第2张图片

 

  • 在服务器上面输入:cat /root/.jenkins/secrets/initialAdminPassword 命令。会出现让输入的密码,一串数字字母,将拿到的密码输入到里面下一步,展示如下图:

jenkins自动化部署_第3张图片

  •  点第一个安装全部插件,如果知道用什么插件点第二个。完成如下图:

jenkins自动化部署_第4张图片

 

  •  点击继续如下图:

jenkins自动化部署_第5张图片

 

  •  填下内容后保存并完成

jenkins自动化部署_第6张图片

 

  • 开始使用,点击就会进来

jenkins自动化部署_第7张图片

  •  安装插件:如下图:(过滤中搜索,勾选上直接安装)需要安装的插件有:git、ssh、maven

jenkins自动化部署_第8张图片

 

 jenkins自动化部署_第9张图片

  •  jenkins中配置环境:

jenkins自动化部署_第10张图片

 

 

 jenkins自动化部署_第11张图片

 

 jenkins自动化部署_第12张图片

 

 jenkins自动化部署_第13张图片

 

  •  构建项目:

 jenkins自动化部署_第14张图片

 

 jenkins自动化部署_第15张图片

 

 jenkins自动化部署_第16张图片

 

  • 生成git秘钥:ssh-keygen -t rsa -C "注册github时的邮箱"。这两文件中pub结尾的配置到github上面,另一个配置到jenkins上面。

 jenkins自动化部署_第17张图片

 

 

 jenkins自动化部署_第18张图片

 jenkins自动化部署_第19张图片

  •  脚本:
    export BUILD_ID=dontkillme
    echo ‘尝试关闭tomcat…’ 
    sh /home/apache-tomcat-8.0.43/bin/shutdown.sh; 
    tom_pid=ps -ef|grep apache-tomcat-8.5.23|grep -v grep| awk '{print $2}' 
    #如果tom_pid长度不为零 not-zero 
    if [ $tom_pid ]; 
    then 
    echo “tomcat 关闭失败,将强制结束进程:$tom_pid” 
    kill -9 $tom_pid; 
    fi 
    echo “tomcat 进程结束” 
    echo “清空weapps目录并复制新war包…” 
    rm -rf /home/apache-tomcat-8.0.43/webapps/*
    cp /root/.jenkins/workspace/web/target/webSocket.war /home/apache-tomcat-8.0.43/webapps/; 
    echo “重新启动tomcat…” 
    cd /home/apache-tomcat-8.0.43/bin/
    ./startup.sh

jenkins自动化部署_第20张图片

 

 jenkins自动化部署_第21张图片

 

 

 

 

 

 


 


  • 安装maven:下载地址:apache-maven-3.3.9-bin.tar.gz  。解压到:/usr/local目录下。 配置环境变量:vim  /etc/profile
    export M2_HOME=/usr/local/apache-maven-3.3.9
    export M2=$M2_HOME/bin
    export PATH=$M2:$PATH
  • 查看maven是否配置成功:

 


 


  • 安装Git(yum源进行安装):yum install git。Git默认安装在:/usr/libexec/git-core  目录下。查看Git安装版本:

  • 这种安装的Gitb版本比较低,安装高版本Git可以通过源码编译安装:
  1. 获取github最新的Git安装包下载链接,进入Linux服务器,执行下载,命令为: wget https://github.com/git/git/archive/v2.17.0.tar.gz ;
  2. 压缩包解压,命令为: tar -zxvf v2.17.0.tar.gz ;
  3. 安装编译源码所需依赖,命令为: yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker 耐心等待安装,出现提示输入y即可;
  4. 安装依赖时,yum自动安装了Git,需要卸载旧版本Git,命令为: yum remove git 出现提示输入y即可;
  5. 进入解压后的文件夹,命令 cd git-2.17.0 ,然后执行编译,命令为 make prefix=/usr/local/git all 耐心等待编译即可;
  6. 安装Git至/usr/local/git路径,命令为 make prefix=/usr/local/git install ;
  7. 打开环境变量配置文件,命令 vim /etc/profile ,在底部加上Git相关配置信息:

    PATH=$PATH:/usr/local/git/bin 

    export PATH 

    然后保存,退出!

  8. 输入命令 git --version ,查看安装的git版本,校验通过,安装成功。

 


 


 

  • 参考:
  1. https://blog.csdn.net/qq_40435659/article/details/81203122
  2. https://www.cnblogs.com/imyalost/p/8715688.html
  3. https://www.cnblogs.com/shihuc/p/5145536.html
  • 问题:
    • jenkins自动部署中执行shell脚本启动tomcat,但是tomcat不启动的问题。

    1. 参考:https://blog.csdn.net/weixin_39483907/article/details/80840948
    2. 处理:
      1.启动 Jenkins 的时候加上 -Dhudson.util.ProcessTree.disable=true2.在后台进程前加上 BUILD_ID=dontkillme。

       

转载于:https://www.cnblogs.com/LJing21/p/11551338.html

你可能感兴趣的:(jenkins自动化部署)