對于其他項目類型,可以使用 warExport
、ejbExport
和 jar
任務(分別用于導出 Web 模塊、EnterpriseJavaBeans (EJB) 模塊和 Java 庫)。這些都是 SDP 提供的 Ant 任務。
在此步驟中,我們將部署上一步導出的單元。對于我們的自動化過程,我們將使用包裝 wsadmin
的內置 Ant 任務。清單 10 顯示了 wsListApps
、wsUninstallApp
和 wsInstallApp
Ant 任務,這些任務分別提供用于列出已安裝應用程序、卸載企業應用程序和安裝企業應用程序的管理功能。請記得在運行此步驟前啟動目標應用服務器。
關于 wsadmin 和 Ant
WebSphere Application Server Ant 支持基于其命令行管理工具 wsadmin
。作為本文示例的替代方法,可以使用 Exec Ant 任務調用 wsadmin
并按照調用任何其他庫執行文件的方式傳遞程序參數。WebSphere Application Server 還提供了包裝 wsadmin
的 Ant 任務 WsAdmin。還有其他包裝特定操作的 WsAdmin 任務的 Ant 任務,如應用程序安裝方面的 InstallApplication 和 StartApplication。我們的示例中使用了后一個選項。
清單 10. 管理企業應用程序
<target name="listapps" description="List installed Enterprise Applications"> <!-- Define the wsListApps task that lists installed Enterprise Applications. --> <taskdef name="wsListApps" classname="com.ibm.websphere.ant.tasks.ListApplications"> <!-- Include all JAR files under WebSphere Application Server lib directory. --> <classpath> <fileset dir="${was.home}/lib/" includes="*.jar" /> </classpath> </taskdef> <!-- List all installed Enterprise Application the profile specified. --> <wsListApps profilename="${was.profilename}" wasHome="${was.home}/" conntype="SOAP" host="${was.hostname}" port="${was.hostport}" user="${was.username}" password="${was.userpassword}" /> </target> <target name="uninstallapp" depends="listapps" |