windows - 不带参数的Ant设置platforms.JDK_1.6.home

标签 windows ant properties java java-home

我在 Windows 机器上尝试运行 ant 时遇到问题。我收到以下错误:

BUILD FAILED
C:\Users\USER\testing\mercurial\project\NetbeansProject\nbproject\build-impl.xml:111: The J2SE Platform is not correctly set up.
 Your active platform is: JDK_1.6, but the corresponding property "platforms.JDK_1.6.home" is not found in the project's properties files.
 Either open the project in the IDE and setup the Platform with the same name or add it manually.
 For example like this:
     ant -Duser.properties.file=<path_to_property_file> jar (where you put the property "platforms.JDK_1.6.home" in a .properties file)
  or ant -Dplatforms.JDK_1.6.home=<path_to_JDK_home> jar (where no properties file is used)

如果我执行ant -Dplatforms.JDK_1.6.home=%JAVA_HOME%它执行得很好,但是,有什么方法可以避免每次我需要构建程序时添加此参数?

最佳答案

我认为不可能设置 ant命令行之外的属性或由构建脚本显式加载的属性文件。

如果您正在寻找一种不太冗长的启动方式 ant ,尝试使用包装器 .bat文件,或分配别名 doskey ant=ant "-Dplatforms.JDK_1.6.home=%JAVA_HOME%"

关于windows - 不带参数的Ant设置platforms.JDK_1.6.home,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15961231/

相关文章:

asp.net - 不允许对其中一个域*进行集成 Windows 身份验证*

windows - 重新打开关闭的文件 : Lua

javascript - React 使用扩展运算符向克隆元素添加新的 props

javascript - Jquery/Javascript 从具有最高属性值的数组中删除条目

c# - 您认为泛型属性在 .NET 中有用吗?

c++ - 使用 windowsAPI 防止其他窗口使用 "overriding"热键

windows - 从函数内部退出批处理脚本

java - ANT:复制文本文件的某些部分

Ant-contrib - For循环错误

android - 使用命令行构建签名的 android APK(无需手动干预)