1

Jenkins の jboss plugin の使用方法が本当にわかりません。明らかなことを調べましたが、たとえば、コンポーネントの使用方法、プロパティの追加などの手がかりがありません.

EAR と複数の WAR をデプロイしたいのですが、JBoss の起動にも問題があります。JBoss 7 は動作しないことに気付きました。以前のバージョンをサポートしているだけです。私はそれを手に入れました、そして私は15秒のタイムアウトにぶつかりました。

4

1 に答える 1

0

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 はエラーに関するメールを送信します。

コードをリファクタリングしたら、最終バージョンを投稿します

于 2013-02-07T14:09:10.710 に答える