cary_candy
作者cary_candy·2011-07-22 15:00
软件开发工程师·JF

Ant websphere 自动部署war

字数 3461阅读 3373评论 4赞 2
websphere express 7.0 version
1.确保ant.bat中的java_home和 websphere一致 
2.确保web.xml有<display-name></display-name>标签 
安装上去了 但不能启动  

-MapWebModToVH {{${project.name} ${project.name}.war,WEB-INF/web.xml default_host}} 
启动成功 但context-root 为/ 不能自定义路径 
继续研究中 
options 里面 添加 context-root=/xx即可 

终于搞定 
listapplication unistallapplication之类的可以照此类推 

<?xml version="1.0" encoding="UTF-8"?> 

<project name="My Application Deployment" default="build-all" basedir="."> 

<!-- ===================================================================== --> 
<!-- define global properties --> 
<!-- ===================================================================== --> 

<property name="remoteHostName" value="localhost" /> 
<property name="remoteConnType" value="SOAP" /> 
<property name="remotePort" value="8880" /> 
<property name="remoteUserId" value="test" /> 
<property name="remotePassword" value="1234" /> 

<!-- change this to your local installation, if different --> 

<property name="deployEar.dir" value="C:/tmp" /> 
<property name="project.name" value="xx" /> 

<!-- change this to your local installation, if different --> 
<property name="wasHome.dir" value="C:/Program Files/IBM/WebSphere/AppServer" /> 
<property name="was.profilename" value="AppSrv01" /> 

<taskdef name="wsInstallApp" classname="com.ibm.websphere.ant.tasks.InstallApplication" > 

<classpath> 
<fileset dir="${wasHome.dir}/plugins/" includes="*.jar" /> 
<fileset dir="${wasHome.dir}/lib/" includes="*.jar" /> 
</classpath> 
</taskdef> 
<!-- 
<wsInstallApp 
wasHome="location of websphere installation" 
ear="the ear file you wish to install" 
options="the options to pass to the installation process" 
properties="java properties file containing attributes to set in the JVM System properties" 
profile="a script file to be executed before the main command or file" 
profileName="the profile name of the desired server" 
conntype="specifies the type of connection to be used." 
host="the host to connect to" 
port="the port on the host to connect to" 
user="user ID to authenticate with" 
password="password to authenticate with" 
failonerror="true | false"/> 
--> 
<target name="installEar"> 
<echo message="EAR File located: ${deployEar.dir}/${deployEar}" /> 
<wsInstallApp profileName="${was.profilename}" ear="${deployEar.dir}/${project.name}.war" 
wasHome="${wasHome.dir}" conntype="${remoteConnType}" 
options=" 
                -MapWebModToVH {{${project.name} ${project.name}.war,WEB-INF/web.xml ${remoteHostName} }} 
-MapModulesToServers {{${project.name} ${project.name}.war,WEB-INF/web.xml WebSphere:cell=cary-mf2t9id1nhNode01Cell,node=cary-mf2t9id1nhNode01,server=server1}} 
                 -context-root /jrepot -appname ${project.name}" 
host="${remoteHostName}" user="${remoteUserId}" password="${remotePassword}" /> 
</target> 

<target name="build-all" depends="installEar"> 

</target> 

</project>

如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!

2

添加新评论4 条评论

lixin199036061lixin199036061网站架构师苏州新宇软件
2011-09-22 13:09
谢了,学习到了
cary_candycary_candy软件开发工程师JF
2011-09-22 11:25
lixin199036061: 用ant来进行发布的话应该还需要辅助的包吧
如果只是单纯的部署的话 不用  部署用到的class  都在这里了<classpath>
<fileset dir="${wasHome.dir}/plugins/" includes="*.jar" />
<fileset dir="${wasHome.dir}/lib/" includes="*.jar" />
</classpath>
cary_candycary_candy软件开发工程师JF
2011-09-22 11:23
lixin199036061: 用ant来进行发布的话应该还需要辅助的包吧
你说的辅助包 是指?第三方jar?
lixin199036061lixin199036061网站架构师苏州新宇软件
2011-09-21 22:43
用ant来进行发布的话应该还需要辅助的包吧
Ctrl+Enter 发表

作者其他文章

相关文章

相关问题

相关资料

X社区推广