使用 java 命令部署 jenkins 战争文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25644837/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Deploying jenkins war file using java command
提问by Mathew
I am trying to deploy a jenkins war file. I executed the following command
我正在尝试部署 jenkins War文件。我执行了以下命令
java -jar jenkins.war
Below is the log file.
下面是日志文件。
PS C:\Sites> java -jar jenkins.war Running from: C:\Sites\jenkins.war webroot: $user.home/.jenkins Sep 03, 2014 6:09:15 PM winstone.Logger logInternal INFO: Beginning extraction from war file Sep 03, 2014 6:09:28 PM org.eclipse.jetty.util.log.JavaUtilLog info INFO: jetty-8.y.z-SNAPSHOT Sep 03, 2014 6:09:35 PM org.eclipse.jetty.util.log.JavaUtilLog info INFO: NO JSP Support for , did not find org.apache.jasper.servlet.JspServlet Jenkins home directory: C:\Users\Mathew.jenkins found at: $user.home/.jenkins Sep 03, 2014 6:09:46 PM org.eclipse.jetty.util.log.JavaUtilLog info INFO: Started [email protected]:8080 Sep 03, 2014 6:09:46 PM winstone.Logger logInternal INFO: Winstone Servlet Engine v2.0 running: controlPort=disabled Sep 03, 2014 6:09:46 PM jenkins.InitReactorRunner$1 onAttained INFO: Started initialization Sep 03, 2014 6:10:26 PM jenkins.InitReactorRunner$1 onAttained INFO: Listed all plugins Sep 03, 2014 6:10:26 PM jenkins.InitReactorRunner$1 onAttained INFO: Prepared all plugins Sep 03, 2014 6:10:26 PM jenkins.InitReactorRunner$1 onAttained INFO: Started all plugins Sep 03, 2014 6:10:26 PM jenkins.InitReactorRunner$1 onAttained INFO: Augmented all extensions Sep 03, 2014 6:10:26 PM jenkins.InitReactorRunner$1 onAttained INFO: Loaded all jobs Sep 03, 2014 6:10:42 PM org.jenkinsci.main.modules.sshd.SSHD start INFO: Started SSHD at port 55062 Sep 03, 2014 6:10:45 PM jenkins.InitReactorRunner$1 onAttained INFO: Completed initialization Sep 03, 2014 6:10:45 PM hudson.WebAppMain$3 run INFO: Jenkins is fully up and running Sep 03, 2014 6:11:48 PM hudson.model.DownloadService$Downloadable load INFO: Obtained the updated data file for hudson.tasks.Maven.MavenInstaller Sep 03, 2014 6:11:51 PM hudson.model.DownloadService$Downloadable load INFO: Obtained the updated data file for hudson.tasks.Ant.AntInstaller Sep 03, 2014 6:11:52 PM hudson.model.DownloadService$Downloadable load INFO: Obtained the updated data file for hudson.tools.JDKInstaller Sep 03, 2014 6:12:11 PM hudson.model.UpdateSite updateData INFO: Obtained the latest update center data file for UpdateSource default
PS C:\Sites> java -jar jenkins.war Running from: C:\Sites\jenkins.war webroot: $user.home/.jenkins Sep 03, 2014 6:09:15 PM winstone.Logger logInternal INFO:开始提取来自War文件 2014 年 9 月 3 日下午 6:09:28 org.eclipse.jetty.util.log.JavaUtilLog 信息信息:jetty-8.yz-SNAPSHOT 2014 年 9 月 3 日下午 6:09:35 org.eclipse.jetty。 util.log.JavaUtilLog 信息信息:没有 JSP 支持,没有找到 org.apache.jasper.servlet.JspServlet Jenkins 主目录:C:\Users\Mathew.jenkins 找到:$user.home/.jenkins Sep 03, 2014 年 6:09:46 PM org.eclipse.jetty.util.log.JavaUtilLog 信息信息:已启动 [email protected]:8080 Sep 03, 2014 6:09:46 PM winstone.Logger logInternal INFO:Winstone Servlet Engine v2。 0 运行:controlPort=disabled 2014 年 9 月 3 日下午 6:09:46 jenkins.InitReactorRunner$1 onAttained INFO:开始初始化 2014 年 9 月 3 日下午 6:10:26 jenkins.InitReactorRunner$1 onAttained INFO:列出所有插件 2014 年 9 月 3 日下午 6:10:26 jenkins.InitReactorRunner$1 onAttained INFO:准备好所有插件 9 月 4 日,6:201 26 PM jenkins.InitReactorRunner$1 onAttained INFO:启动所有插件 2014 年 9 月 3 日下午 6:10:26 jenkins.InitReactorRunner$1 onAttained INFO:2014 年 9 月 3 日 6:10:26 PM jenkins.所有作业 2014 年 9 月 3 日下午 6:10:42 org.jenkinsci.main.modules.sshd.SSHD 启动信息:在端口 55062 2014 年 9 月 3 日下午 6:10:45 启动 SSHD jenkins.InitReactorRunner$1 onAttained INFO:完成信息: 2014 年 9 月 3 日下午 6:10:45 hudson.WebAppMain$3 运行信息:Jenkins 完全启动并运行 2014 年 9 月 3 日下午 6:11:48 hudson.model.DownloadService$Downloadable 加载信息:获得了 hudson.tasks.Maven.MavenInstaller 的更新数据文件 2014 年 9 月 3 日下午 6:11:51 hudson.model.DownloadService$Downloadable 加载信息:获得了 hudson.tasks.Ant.AntInstaller 的更新数据文件 2014 年 9 月 3 日下午 6:11:52 hudson.model.DownloadService$Downloadable load INFO:获得了 hudson.tools.JDKInstaller 的更新数据文件 2014 年 9 月 3 日下午 6:12:11 hudson.model.UpdateSite updateData INFO:获得了最新的更新中心UpdateSource 默认的数据文件2014 6:12:11 PM hudson.model.UpdateSite updateData INFO:获取UpdateSource默认的最新更新中心数据文件2014 6:12:11 PM hudson.model.UpdateSite updateData INFO:获取UpdateSource默认的最新更新中心数据文件
- Can anyone tell me what does the command
java-jar jenkins.war
do? - WHere did it deploy my war file?
- Which web server does it use and how does localhost:8080 point to jenkins application?
- 谁能告诉我命令是
java-jar jenkins.war
做什么的? - 它在哪里部署了我的War文件?
- 它使用哪个 Web 服务器以及 localhost:8080 如何指向 jenkins 应用程序?
回答by Technext
Q. Can anyone tell me what does the command java -jar jenkins.war do?
问:谁能告诉我 java -jar jenkins.war 命令的作用是什么?
java -jar
expects a jar file name, in this case, jenkins.war.
java -jar
需要一个 jar 文件名,在本例中为 jenkins.war。
An executable Java program can be packaged in a JAR file, along with any libraries the program uses. Executable JAR files have the manifest specifying the entry point class with Main-Class: myPrograms.MyClass and an explicit Class-Path (and the -cp argument is ignored). Some operating systems can run these directly when clicked. The typical invocation is "java -jar foo.jar" from a command line
可执行 Java 程序可以与程序使用的任何库一起打包在 JAR 文件中。可执行 JAR 文件的清单指定了带有 Main-Class: myPrograms.MyClass 和显式 Class-Path 的入口点类(忽略 -cp 参数)。单击某些操作系统可以直接运行这些。典型的调用是来自命令行的“java -jar foo.jar”
Reference: http://en.wikipedia.org/wiki/JAR_(file_format)
参考:http: //en.wikipedia.org/wiki/JAR_(file_format)
Q. Where did it deploy my war file?
问:它在哪里部署我的War文件?
In case it is a RHEL/CentOS installation, your war is deployed at /var/lib/jenkins
如果是 RHEL/CentOS 安装,则您的War部署在 /var/lib/jenkins
You can find out the location by reading the file /etc/init.d/jenkins. You will find a variable named JENKINS_CONFIG
您可以通过阅读文件 /etc/init.d/jenkins 来找出位置。你会发现一个名为的变量JENKINS_CONFIG
JENKINS_CONFIG=/etc/sysconfig/jenkins
Q. Which web server does it use and how does localhost:8080 point to jenkins application?
问:它使用哪个 Web 服务器以及 localhost:8080 如何指向 jenkins 应用程序?
In case it is a RHEL/CentOS installation, you will generally find the file here: /etc/sysconfig/jenkins
. In this file, you define port on which Jenkins runs.
如果是 RHEL/CentOS 安装,您通常会在此处找到该文件:/etc/sysconfig/jenkins
. 在此文件中,您定义运行 Jenkins 的端口。
回答by cghislai
1) It executes the java arvhive jenkins.war (see http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jar.html)
1)它执行java arvhive jenkins.war(参见http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jar.html)
2) From the output you posted yourself:
2)从您自己发布的输出中:
Running from: C:\Sites\jenkins.war webroot: $user.home/.jenkins
the user.home
variable may refer to your ~
directory on Linux, or your Document and Settings on windows. See http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html
该user.home
变量可能指的是您~
在 Linux上的目录,或您在 Windows 上的文档和设置。请参阅http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html
3) From the output you posted yourself:
3)从您自己发布的输出中:
jetty-8.y.z-SNAPSHOT
INFO: Started [email protected]:8080
jetty-8.y.z-SNAPSHOT
INFO: Started [email protected]:8080
See http://www.eclipse.org/jetty/. This is a web server that register a listener on port 8080.
请参阅http://www.eclipse.org/jetty/。这是在端口 8080 上注册侦听器的 Web 服务器。
回答by Kalpesh Soni
it uses the Manifest.mf inside, if you open the war, you would understand how it runs
它使用里面的Manifest.mf,如果你打开war,你就会明白它是如何运行的
The Main class uses winstone http://winstone.sourceforge.net/
Main 类使用 winstone http://winstone.sourceforge.net/
I would recommend to use glassfish, jetty or tomcat - for better control on configuration
我建议使用 glassfish、jetty 或 tomcat - 为了更好地控制配置
there is a bug open for that https://issues.jenkins-ci.org/browse/JENKINS-18366
有一个错误打开 https://issues.jenkins-ci.org/browse/JENKINS-18366
Also see various container notes https://wiki.jenkins-ci.org/display/JENKINS/Containers
另请参阅各种容器说明 https://wiki.jenkins-ci.org/display/JENKINS/Containers