2

build.xml を作成し、master build.xml を作成し、jar war ear ファイルを作成しました。

apache ant を使用してマスター build.xml ファイルから jboss サーバーを停止および起動したい

次に、すべての戦争と耳をコピーします

4

2 に答える 2

2

とてもシンプルです

<!-- Start Jboss -->
<target name="start-jboss" description="Starts back-end EJB container" depends="prepare">
    <exec executable="${jboss.bin.dir}/run.bat" spawn="false">
    </exec>
    <copy todir="destination of where you want the file to go" overwrite="true">
       <fileset file="myfile.war" />
       <fileset file="myfile.ear" />
    </copy>
    <echo>+-----------------------------+</echo>
    <echo>| J B O S S   S T A R T E D   |</echo>
    <echo>+-----------------------------+</echo>
</target>

<!-- Stop Jboss -->
<target name="stop-jboss" description="Stops back-end EJB container" depends="prepare">
    <exec executable="${jboss.bin.dir}/shutdown.bat" spawn="false">
        <arg line="-S" />
    </exec>
            <copy todir="destination to where you want the file to go" overwrite="true">
            <fileset file="myfile.war" />
            <fileset file="myfile.ear" />
            </copy>
    <echo>+-----------------------------+</echo>
    <echo>| J B O S S   S T O P P E D   |</echo>
    <echo>+-----------------------------+</echo>

</target>

これが役立つことを願っています:)

于 2012-05-28T14:15:26.087 に答える
1

ここに示すように、コマンドラインからリモートでjbossを停止できます(これはあなたが望むものだと思います)。ローカルで、つまり、jbossが実行されているのと同じマシンでビルドファイルを実行する場合、antsexecコマンド で簡単にこれを行うことができます。

于 2012-04-19T10:50:23.870 に答える