本人最近学习使用jenkins+svn+ant 自动部署ear文件。因此特此记录一下如何经过ant 自动部署ear文件到weblogic.web
一般咱们能够经过weblogic直接发布application, 就是经过登录weblogic web console经过上传ear/war 文件发布到服务器上面。服务器
下面咱们就经过ant 来实现相似upload ear file的功能。oracle
这里假设ear文件已经就绪。重点说明如何经过ant 来部署ear到weblogic.app
weblogic.classpath=/Oracle/Middleware1211c/wlserver_12.1/server/lib/weblogic.jar <property name="class.path.oracle.weblogic" value="${ThirdPartyLibs.home.lib}/oracle/weblogic/wls11/wlfullclient.jar" /> ... <target name="deploy_admin_server" depends="setup-env,setup-classPath"> <!-- step1:定义ant task 经过weblogic提供的类--> <taskdef name="wldeploy" classname="weblogic.ant.taskdefs.management.WLDeploy" > <classpath> <pathelement location="${weblogic.classpath}"/> <pathelement location="${class.path.oracle.weblogic}"/> </classpath> </taskdef> <!--step2:create ear file --> <antcall target="release" inheritall="true" inheritrefs="true"></antcall> <!-- step3:自动部署--> <wldeploy action="deploy" verbose="true" debug="true" name="LAUSToo" source="${build.dir.app}${file.separator}${name.release}${file.separator}Dev-${release.name}.${release.version}.ear" user="用户名" password="密码" adminurl="t3://localhost:7001" targets="AdminServer" /> </target>
其实ant 部署ear/war 文件就是 须要三个步骤dom
1 定义weblogic提供的自动部署的ant 任务。ide
2 生成ear/war 文件svn
3 调用wldeploy 指令来自动部署ear/war 到welogic.学习
最后简单解释如下的wldeploy 的参数ui
action: 有三个参数deploy/redeploy/undeploy
url
source: 就是ear/war 文件的路径
user: weblogic 这个domain的用户名
password:密码
adminurl:就是这个服务器的域名路径
target:部署到那个服务器
***这里注意如下为了若是部署不成功,出现没法链接到weblogic。 有须要enable tuneling.这个选项***