操作系統升級後無法從 ANT 訪問環境變量 (Can't access env vars from ANT after OS upgrade)


問題描述

操作系統升級後無法從 ANT 訪問環境變量 (Can't access env vars from ANT after OS upgrade)

A server was upgraded from Windows 2000 to Windows 2003 and now I can't access environment variables from Ant build scripts.

I can still access them fine from a command line, but ${env.JAVA_HOME} for instance fails.

How can I fix this without rewriting ~100 build scripts that work on all other servers to be customized for this server?


參考解法

方法 1:

Unfortunately I don't think you should have been using that environment variable. To get around such problems there's the builtin ${java.home} you could have been using, which isn't dependent on the operating system and/or user's environment being setup properly. (See the Ant manual discussion of built-in properties in Ant.)

You may be able to get around rewriting all your build scripts by either (1) setting the JAVA_HOME environment variable manually, or (2) modifying the ant.bat file to assign it manually. Both options are brittle because they'll break when Java gets upgraded, but at least they'll likely fail fast.

(by TristanChris Winters)

參考文件

  1. Can't access env vars from ANT after OS upgrade (CC BY-SA 3.0/4.0)

#upgrade #windows-server-2003 #ant






相關問題

我如何知道哪個應用程序版本正在被 android 替換? (How do I know which app version is being replaced with android?)

升級到 Mac OS Lion - 如何備份 Ruby、*SQL 等? (Upgrade to Mac OS Lion - how to backup Ruby, *SQL, etc?)

將 jQuery 1.4.2 升級到 1.9.1 (Upgrade jQuery 1.4.2 to 1.9.1)

將 Jquery.min 升級到 Jquery.1.9 時出錯 (Error Upgrade Jquery.min into Jquery.1.9)

Building Wix 3.0 升級和補丁 (Building Wix 3.0 upgrade and patch)

Rails flash 拋出錯誤數量的參數(0 代表 2)錯誤 (Rails flash is throwing wrong number of arguments (0 for 2) error)

操作系統升級後無法從 ANT 訪問環境變量 (Can't access env vars from ANT after OS upgrade)

從 Rails 1.x 轉換到 2.x 是否有任何機械幫助? (Is there any mechanical assistance in converting from Rails 1.x to 2.x?)

Team Foundation Server 2015 到 2018 升級錯誤(步驟 909) (Team Foundation Server 2015 to 2018 Upgrade Error (Step 909))

運行 Tensorflow2 升級腳本會觸發編碼錯誤 (Running the Tensorflow2 upgrade Script triggers an encoding error)

將 Angular 5 升級到 Angular 11 (Upgrade angular 5 to angular 11)

在 centOS 6.9 (Final) 中將 php-5.6 升級到 7.3 時顯示多個錯誤 (Showing multiple errors while upgrading php-5.6 to 7.3 in centOS 6.9 (Final))







留言討論