[英]Using Jenkins JBoss plugin
I can't really find how to use Jenkins' jboss plugin . 我真的找不到如何使用Jenkins的jboss插件 。 I went through things what are obvious, but for example I have no clue how to use the component, adding what properties etc. 我经历了显而易见的事情,但是例如,我不知道如何使用组件,添加什么属性等。
I want to deploy an EAR and multiple WARs, and I have problem even with start JBoss. 我想部署一个EAR和多个WAR,即使启动JBoss也遇到问题。 I realized that JBoss 7 won't run, it simply supports earlier version. 我意识到JBoss 7将无法运行,它仅支持早期版本。 I got it, and I bumped to 15 sec timeout. 我知道了,并且超时了15秒。
I could only make a workaround with ANT. 我只能使用ANT解决。 I hope it will be helpful for the next person who thinks that Jenkins' jboss plugin works... it isn't with the v7.1.1 for sure. 我希望这对下一个认为Jenkins的jboss插件有效的人会有所帮助……肯定不能与v7.1.1一起使用。
So the workaround: 所以解决方法:
Check if JBoss responds 检查JBoss是否响应
<condition property="jboss.online">
<socket server="localhost" port="8080"/>
</condition>
If yes, stop JBoss and delete all deployments 如果是,请停止JBoss并删除所有部署
<target name="stop" depends="-check-status" if="${start.successful}">
<java jar="${jboss.home}/jboss-modules.jar" fork="true">
<arg line="-mp ${jboss.home}/modules org.jboss.as.cli -c command=:shutdown" />
</java>
<sleep seconds="10" />
<delete quiet="false" includeEmptyDirs="true">
<fileset dir="${jboss.home}/standalone/deployments/">
<include name="**/*" />
</fileset>
</delete>
</target>
Copy all ears and wars to deployments 将所有精力和精力复制到部署中
<copy file="${publish.dir}/main.ear" overwrite="true" todir="${jboss.home}/standalone/deployments" />
<copy file="${publish.dir}/first.war" overwrite="true" todir="${jboss.home}/standalone/deployments" />
<copy file="${publish.dir}/second.war" overwrite="true" todir="${jboss.home}/standalone/deployments" />
Start JBoss 启动JBoss
<exec executable="${jboss.home}/bin/standalone.bat" spawn="true">
Wait for deployments and start unit tests 等待部署并开始单元测试
<!-- startup, deploy -->
<target name="deploy-war" description="deploy war file" depends="-start">
<condition property="jboss.online">
<socket server="localhost" port="8080"/>
</condition>
<echo message="${jboss.online}"> ONLINE STATUS</echo>
<sequential>
<echo>WAITING FOR DEPLOYMENT...</echo>
<waitfor>
<or>
<available file="${jboss.home}/standalone/deployments/main.ear.deployed" />
<available file="${jboss.home}/standalone/deployments/main.ear.failed" />
</or>
</waitfor>
<condition property="deployed">
<available file="${jboss.home}/standalone/deployments/main.ear.deployed" />
</condition>
<antcall target="deploy.failed"/>
<antcall target="deploy.success"/>
<echo>+----------------------------+</echo>
<echo>| W A R D E P L O Y E D |</echo>
<echo>+----------------------------+</echo>
</sequential>
</target>
<!-- Deploy success, run unit tests -->
<target name="deploy.success" if="deployed">
<echo>DEPLOY SUCCESS</echo>
<sleep seconds="10" />
<antcall target="unit-test.-multi-only-unit-test-noreport"></antcall>
</target>
<!-- Deploy failed, fail -->
<target name="deploy.failed" unless="deployed">
<echo>DEPLOY FAILED</echo>
<fail/>
</target>
if anything fails call an ant error, so Jenkins will send mail about the error. 如果有任何失败,则称为ant错误,因此Jenkins将发送有关该错误的邮件。
When I refactor my code I will post the final version 当我重构代码时,我将发布最终版本
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.