繁体   English   中英

使用Jenkins JBoss插件

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM