ANT 构建在 WS_ANT 中运行良好,但在 RAD 中失败

发布于 2024-11-30 00:31:14 字数 2257 浏览 2 评论 0原文

只是尝试在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

江南烟雨〆相思醉 2024-12-07 00:31:14

如果您查看 ws_ant.bat 文件,您会发现它首先调用 setupCmdLine.bat,您猜对了,它是设置命令行。该文件尝试通过将 WAS_HOME 设置为父目录来确定环境变量。

SET CUR_DIR=%cd%
cd /d "%~dp0.."
SET WAS_HOME=%cd%
cd /d "%CUR_DIR%"

当您从命令行运行时,这很好。您通常位于 ~/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.

SET CUR_DIR=%cd%
cd /d "%~dp0.."
SET WAS_HOME=%cd%
cd /d "%CUR_DIR%"

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文