开发者

Deploy a app in weblogic only if it is not already present in it using ant wldeploy task

开发者 https://www.devze.com 2023-02-08 20:27 出处:网络
how can i deploy a app 开发者_如何学Cin weblogic only if it is not present in itusing wldeploy ant task
  • how can i deploy a app 开发者_如何学Cin weblogic only if it is not present in it using wldeploy ant task
  • when i run ant testapp it deploys fresh everytime over existing app as far as i could see in console messages (ie in sysout).
  • i call this ant target as dependency in some other target, and i want this to run only if app is not already present in weblogic server (to be more efficient)

<target name="testapp" depends="init-wls"> <wldeploy action="deploy" verbose="true" debug="true" name="testapp" failonerror="false" ... source="testapp.war"/> </target>


an interesting question. I'm not sure if wldeploy can do what you want. One approach that might work would be to use the wlconfig ant task. You could use it to get the ApplicationRuntimeMBeans and then query their ApplicationName attributes (again, with wlconfig task) to see if the application is deployed. Not super straightforward but at least you would avoid the application redeployment.

This is just a quick idea off the top of my head so not sure if it is feasible in practice, sorry.... :)

--edit: tried it out, something like this should work, the assumption here is that if we can find the MBean then it is already deployed which should be a valid assumption since these beans live under AppDeployments:

<project name="test" default="deploy">
     <property name="domainName" value="ejbTestDomain"/>
     <property name="serverName" value="AdminServer"/>
     <property name="appName" value="ejbWebEAR"/>
     <target name="findApp">
              <wlconfig url="t3://localhost:7001" username="weblogic" password="password_for_weblogic">
                       <query pattern="${domainName}:ServerRuntime=${serverName},Name=${appName},*,Type=ApplicationRuntime" property="app.is.deployed"/>
              </wlconfig>
     </target>
     <target name="deploy" unless="app.is.deployed" depends="findApp">
              <echo message="Deploying..."/>
              <!-- deploy using wldeploy task -->
     </target>
</project>
0

精彩评论

暂无评论...
验证码 换一张
取 消