【问题标题】:ANT build runs fine with WS_ANT but fails in RADANT 构建在 WS_ANT 下运行良好,但在 RAD 中失败
【发布时间】:2011-10-27 03:14:34
【问题描述】:

只是尝试在 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>

【问题讨论】:

    标签: ant websphere websphere-7 ibm-rational


    【解决方案1】:

    如果您查看 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 脚本时,我会考虑设置工作目录。这可能是最可能的原因。

    【讨论】:

      猜你喜欢
      • 2019-04-25
      • 1970-01-01
      • 2011-07-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-29
      • 1970-01-01
      相关资源
      最近更新 更多