指定 JDK 供 Maven 使用 [英] Specify JDK for Maven to use

查看:26
本文介绍了指定 JDK 供 Maven 使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个我修改过的 Hudson 插件,它需要 jdk1.6.这很好,但我不知道如何告诉 Maven 不同的 jdk 在哪里.我在互联网上发现很少提及,但它们似乎不适用于我.有人建议向 .m2/settings.xml 添加一些配置,但我没有 settings.xml.另外,我不想将 1.6 用于所有 maven 构建.

I am trying to build a Hudson plugin I've modified and it requires jdk1.6. This is fine, but I don't see how I can tell maven where the different jdk is. I've found few mentions on the internet but they don't seem to apply to me. Some suggest adding some config to .m2/settings.xml but I don't have a settings.xml. Plus, I don't want to use 1.6 for all maven builds.

一个问题是我在 cygwin 中使用 mvn,如果这很重要的话.看来我应该能够在项目 pom 文件中制定规范,但现有的 pom 非常简单.

One kink is I am using mvn in cygwin, if that matters at all. It appears I should be able to make the specification in the project pom file, but the existing pom is pretty bare.

所以最重要的是,有没有办法为 maven 的单个调用指定一个 jdk?

So bottom line is, is there a way to specify a jdk for a single invocation of maven?

推荐答案

所以最重要的是,有没有办法为 maven 的单个调用指定一个 jdk?

So bottom line is, is there a way to specify a jdk for a single invocation of maven?

临时更改您的 JAVA_HOME 环境变量的值.

Temporarily change the value of your JAVA_HOME environment variable.

这篇关于指定 JDK 供 Maven 使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆