ANT 构建在 WS_ANT 中运行良好,但在 RAD 中失败
只是尝试在 IBM RAD\RSA 8 中运行 ANT 脚本以部署到 websphere 。 使用 WS_ANT.bat 从命令提示符运行时工作正常,但在 RAD 内部失败并出现以下错误
Unable to determine WAS Home directory. Please use the wasHome task attribute or set the was.root System property.
以下是从 SO 复制的基本 ANT 脚本并再次修改,从 WS_ANT 运行正常,但从 RAD 运行不正常
<?xml version="1.0"?>
<projectname="project"default="wasListApps"basedir=".">
<description>
Script for listing installed apps.
Example run from:
/opt/IBM/SDP70/runtimes/base_v61/profiles/AppSrv01/bin
</description>
<propertyname="was_home"location="C:\Program Files\ibm\SDP80\runtimes\base_v7"/>
<pathid="was.runtime">
<filesetdir="${was_home}/lib">
<includename="**/*.jar"/>
</fileset>
<filesetdir="${was_home}/plugins">
<includename="**/*.jar"/>
</fileset>
</path>
<propertyname="was_cp"value="${toString:was.runtime}">
</property>
<propertyname="was_server"value="server1"/>
<propertyenvironment="env">
</property>
<targetname="wsStopServer">
<taskdefname="wsStopServer"classname="com.ibm.websphere.ant.tasks.StopServer"classpath="${was_cp}">
</taskdef>
<wsStopServerserver="${was_server}"failonerror="false"/>
</target>
<targetname="wsStartServer" depends="wsStopServer">
<taskdefname="wsStartServer"classname="com.ibm.websphere.ant.tasks.StartServer"classpath="${was_cp}">
</taskdef>
<wsStartServerserver="${was_server}"failonerror="true"/>
</target>
<targetname="wasListApps"depends="wsStartServer">
<taskdefname="wsListApp"classname="com.ibm.websphere.ant.tasks.ListApplications"classpath="${was_cp}">
</taskdef>
<wsListAppwasHome="${was_home}"/>
</target>
</project>
Just trying to run ANT script with in IBM RAD\RSA 8 to deploy to websphere .
It works fine when run from command prompt using WS_ANT.bat but inside RAD fails with following error
Unable to determine WAS Home directory. Please use the wasHome task attribute or set the was.root System property.
Following is basic ANT script copied from SO and Modified again runs fine from WS_ANT but not from RAD
<?xml version="1.0"?>
<projectname="project"default="wasListApps"basedir=".">
<description>
Script for listing installed apps.
Example run from:
/opt/IBM/SDP70/runtimes/base_v61/profiles/AppSrv01/bin
</description>
<propertyname="was_home"location="C:\Program Files\ibm\SDP80\runtimes\base_v7"/>
<pathid="was.runtime">
<filesetdir="${was_home}/lib">
<includename="**/*.jar"/>
</fileset>
<filesetdir="${was_home}/plugins">
<includename="**/*.jar"/>
</fileset>
</path>
<propertyname="was_cp"value="${toString:was.runtime}">
</property>
<propertyname="was_server"value="server1"/>
<propertyenvironment="env">
</property>
<targetname="wsStopServer">
<taskdefname="wsStopServer"classname="com.ibm.websphere.ant.tasks.StopServer"classpath="${was_cp}">
</taskdef>
<wsStopServerserver="${was_server}"failonerror="false"/>
</target>
<targetname="wsStartServer" depends="wsStopServer">
<taskdefname="wsStartServer"classname="com.ibm.websphere.ant.tasks.StartServer"classpath="${was_cp}">
</taskdef>
<wsStartServerserver="${was_server}"failonerror="true"/>
</target>
<targetname="wasListApps"depends="wsStartServer">
<taskdefname="wsListApp"classname="com.ibm.websphere.ant.tasks.ListApplications"classpath="${was_cp}">
</taskdef>
<wsListAppwasHome="${was_home}"/>
</target>
</project>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您查看 ws_ant.bat 文件,您会发现它首先调用 setupCmdLine.bat,您猜对了,它是设置命令行。该文件尝试通过将 WAS_HOME 设置为父目录来确定环境变量。
当您从命令行运行时,这很好。您通常位于 ~/SDP/runtimes/base_v7/bin (或其他服务器版本)目录中。父母就是你想去的地方。
我会在运行 ws_ant.bat 脚本时考虑设置工作目录。这可能是最有可能的原因。
If you look at the ws_ant.bat file you will find it calls the setupCmdLine.bat first thing to, you guessed it, setup the command line. That file tries to determine the WAS_HOME environment variable by setting it to the parent directory.
This is fine when you run from the command line. You are usually in the ~/SDP/runtimes/base_v7/bin (or other server version) directory. The parent is where you want to be.
I would look into setting the working directory when you run the ws_ant.bat script. That is probably the most likely cause.