[英]Using Jenkins JBoss plugin
我真的找不到如何使用Jenkins的jboss插件 。 我經歷了顯而易見的事情,但是例如,我不知道如何使用組件,添加什么屬性等。
我想部署一個EAR和多個WAR,即使啟動JBoss也遇到問題。 我意識到JBoss 7將無法運行,它僅支持早期版本。 我知道了,並且超時了15秒。
我只能使用ANT解決。 我希望這對下一個認為Jenkins的jboss插件有效的人會有所幫助……肯定不能與v7.1.1一起使用。
所以解決方法:
檢查JBoss是否響應
<condition property="jboss.online">
<socket server="localhost" port="8080"/>
</condition>
如果是,請停止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 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" />
啟動JBoss
<exec executable="${jboss.home}/bin/standalone.bat" spawn="true">
等待部署並開始單元測試
<!-- 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>
如果有任何失敗,則稱為ant錯誤,因此Jenkins將發送有關該錯誤的郵件。
當我重構代碼時,我將發布最終版本
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.