build.xml を作成し、master build.xml を作成し、jar war ear ファイルを作成しました。
apache ant を使用してマスター build.xml ファイルから jboss サーバーを停止および起動したい
次に、すべての戦争と耳をコピーします
とてもシンプルです
<!-- 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>
これが役立つことを願っています:)
ここに示すように、コマンドラインからリモートでjbossを停止できます(これはあなたが望むものだと思います)。ローカルで、つまり、jbossが実行されているのと同じマシンでビルドファイルを実行する場合、antsexec
コマンド
で簡単にこれを行うことができます。