如何使用特定的OpenJDK版本酿造ANT?
我正在尝试安装 Ant,使其使用 OpenJDK@11 而不是最新的 OpenJDK 构建? brew install ant
当前使用 OpenJDK@18 安装它。我正在使用 ant 从源代码使用 Java 构建 OpenCV,并且我需要使用 Java 11 构建它。
我已经运行 brew edit ant
并尝试配置以下内容:
def install
rm Dir["bin/*.{bat,cmd,dll,exe}"]
libexec.install Dir["*"]
bin.install_symlink Dir["#{libexec}/bin/*"]
rm bin/"ant"
(bin/"ant").write <<~EOS
#!/bin/bash
JAVA_HOME="${JAVA_HOME:-#{Formula["openjdk"].opt_prefix}}" exec "#{libexec}/bin/ant" -lib #{HOMEBREW_PREFIX}/share/ant "$@"
EOS
但还没有幸运的是配置正确。任何帮助表示赞赏!
I'm trying to install Ant such that it is built with OpenJDK@11 instead of the latest OpenJDK?brew install ant
installs it with OpenJDK@18 currently. I'm using ant to build OpenCV with Java from source, and I need it to be built with Java 11.
I've run brew edit ant
and tried to configure the following:
def install
rm Dir["bin/*.{bat,cmd,dll,exe}"]
libexec.install Dir["*"]
bin.install_symlink Dir["#{libexec}/bin/*"]
rm bin/"ant"
(bin/"ant").write <<~EOS
#!/bin/bash
JAVA_HOME="${JAVA_HOME:-#{Formula["openjdk"].opt_prefix}}" exec "#{libexec}/bin/ant" -lib #{HOMEBREW_PREFIX}/share/ant "$@"
EOS
But haven't had luck with getting the config right. Any help is appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
This is the diff that you need (basically replace
openjdk
withopenjdk@11
):After
brew edit ant
, and thenbrew install -s ant
,应该就是这样。This is the diff that you need (basically replace
openjdk
withopenjdk@11
):After
brew edit ant
, and thenbrew install -s ant
, that should be it.