如何使用jenkins的Build-> Execute shell选项生成war文件? [英] How to generate war file using jenkins Build->Execute shell option?

查看:151
本文介绍了如何使用jenkins的Build-> Execute shell选项生成war文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  • 我是Jenkin和svn的新手.我已经将Java项目提交到 资料库.现在如何通过shell选项生成war文件.

  • I am new to Jenkin and svn. I have commited the java project into repository. now how to generate the war file through shell option.

什么是构建后操作->归档工件"选项,我应该在要归档的文件"选项中提供什么输入

What is Post-build Actions->Archive the Artifacts option, what input should i provide in "files to archive option"

推荐答案

您的战争现在如何从命令行进行?例如,如果您使用Ant,则可以这样做:

How does your war now build from the command line? For example, if you use Ant, you might do:

$ ant war

如果您使用Maven,它将是:

If you use Maven, it'll be:

$ mvn war

这是您必须知道的第一件事. Jenkins可以在Maven中自动运行Ant build.xml文件或运行pom.xml.这些恰好是两个内置的构建任务.但是,如果您使用Shell脚本或其他命令进行构建,则也可以在Jenkins中指定. 构建部分下方是一个添加构建步骤.选择是否使用调用Ant 构建Maven顶级目标执行Windows Batch命令执行Shell ,等等.然后填写提示.例如,如果您使用Ant构建,则将要求您选择要使用的Ant版本以及要执行的目标.

That's the first thing you must know. Jenkins can automatically run an Ant build.xml file or run a pom.xml in Maven. These happen to be two built-in build tasks. However, if you use a shell script or some other command to do the build, you can specify that too in Jenkins. Under the Build section is a Add build step. Select whether to build with Invoke Ant, Build Maven Top Level Targets, Execute Windows Batch Command, Execute Shell, etc. Then fill in the prompts. For example, if you build with Ant, you'll be asked to select the Ant version you want to use, and the target to execute.

一旦您真正在Jenkins中构建了某些东西,就需要问问自己,战争或您正在构建的任何东西实际存在于工作目录中.弄清楚之后,您只需将位置放在 Archive Artifacts 选项中即可.您也可以简单地放入**/*.war,并且您构建中的所有war文件都将被存档.由于怀疑您的项目中有不止一场战争,因此您也许可以摆脱它.

Once you actually build something in Jenkins, you need to ask yourself where does the war or whatever you're building actually exist in the working directory. Once you figure that out, you can simply put the location in the Archive Artifacts option. You can also simply put **/*.war, and all war files in your build will be archived. Since it's doubtful that you have more than one war in your project, you may be able to get away with that.

这篇关于如何使用jenkins的Build-> Execute shell选项生成war文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆