如何用ANT脚本安装weblogic

本文介绍了一种使用Ant脚本自动化安装WebLogic服务器的方法。通过检测操作系统类型和安装文件的存在情况,脚本能够智能地选择正确的安装流程。对于Linux和Windows环境,脚本会准备必要的文件并执行静默安装。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

如何用ANT脚本安装weblogic


<target name=”installWebLogic10MP1″ description=”install weblogic 10 MP1″>
<available file=”${java.tools.home}/weblogic/server1001_linux32.bin” type=”file” property=”weblogic.linux.binary”/>

//检测weblogic安装文件
<available file=”${java.tools.home}/weblogic/server1001_win32.exe” type=”file” property=”weblogic.windows.binary”/>
<if>
<equals arg1=”${os.name}” arg2=”Linux”/>

、、检测操作系统类型
<then>
<if>
<equals arg1=”${weblogic.linux.binary}” arg2=”true”/>
<else>
<mkdir dir=”${java.tools.home}/weblogic”/>
<get src=”安装文件目录” dest=”${java.tools.home}/weblogic/server1001_linux32.bin” verbose=”true”/>
<chmod file=”${java.tools.home}/weblogic/server1001_linux32.bin” perm=”777″/>
</else>
</if>
</then>
<else>
<if>
<equals arg1=”${weblogic.windows.binary}” arg2=”true”/>
<else>
<mkdir dir=”${java.tools.home}/weblogic”/>
<get src=”weblogic安装文件url” dest=”保存安装文件的目录” verbose=”true”/>
</else>
</if>
</else>
</if>
<resourcecount property=”bea.files”>
<fileset dir=”${env.BEA_HOME}”/>
</resourcecount>
<if>
<equals arg1=”${bea.files}” arg2=”0″/>
<else>
<input message=”You’re BEA_HOME directory is not empty and it needs to be for a successful webLogic 10 installation.  Would you like me to clean it for you?” validargs=”y,n” addproperty=”do.delete”/>
<if>
<equals arg1=”${do.delete}” arg2=”y”/>
<then>
<delete includeemptydirs=”true”>
<fileset dir=”${env.BEA_HOME}” includes=”**/*”/>
</delete>
</then>
<else>

<fail message=”You have not met the requirements to install webLogic 10.  Please either select a pristine BEA_HOME or remove what is currently in your BEA_HOME.”/>
</else>
</if>
</else>
</if>
<antcall target=”replaceSilentInstallProperties10″/>
<if>
<equals arg1=”${os.name}” arg2=”Linux”/>
<then>
<exec executable=”${java.tools.home}/weblogic/server1001_linux32.bin”>
<arg value=”-mode=silent”/>
<arg value=”-silent_xml=${gen.src.project}/weblogic/silent.xml”/>
</exec>
<delete file=”${java.tools.home}/weblogic/server1001_linux32.bin”/>
</then>
<else>
<exec executable=”${java.tools.home}/weblogic/server1001_win32.exe”>
<arg value=”-mode=silent”/>
<arg value=”-silent_xml=${gen.src.project}/weblogic/silent.xml”/>
</exec>
<delete file=”${java.tools.home}/weblogic/server1001_win32.exe”/>
</else>
</if>
</target>

<target name=”replaceSilentInstallProperties10″ description=”replace tokens in the webLogic silent.xml file”>
<delete dir=”${gen.src.project}/weblogic”/>
<mkdir dir=”${gen.src.project}/weblogic”/>
<copy file=”${resource.weblogic}/10/tokenized.silent.xml” tofile=”${gen.src.project}/weblogic/silent.xml”/>
<replace file=”${gen.src.project}/weblogic/silent.xml” token=”BEA-HOME-NEEDS-TO-BE-SET” value=”${bea.home}”/>
<replace file=”${gen.src.project}/weblogic/silent.xml” token=”WEBLOGIC-HOME-NEEDS-TO-BE-SET” value=”${weblogic.home}”/>
</target>


来自我的小站 www.threes.cn


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值