在用户的gradle.properties中设置JDK home(javac路径) [英] Set JDK home (javac path) in user's gradle.properties

查看:1799
本文介绍了在用户的gradle.properties中设置JDK home(javac路径)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在我的gradle项目中指定 javac 的路径。我可以通过将以下内容添加到我的 build.gradle 文件中:

  options.forkOptions.executable ='/home/mj/lib/jdk1.7.0_80/bin/javac'

问题是这个文件是在我们的仓库中共享的,我不希望设置被推送到那里。我试图把它放在我的本地 gradle.properties 文件中,但它不起作用。同样设置 gradle.java.home 不会影响这个。我想这是因为Gradle对 java 使用 gradle.java.home 而不是 javac ,对吗?我也(绝望地)尝试设置一个 gradle.jdk.home 哪(不奇怪)不起作用!



在build.gradle中包含项目之外的任何地方吗?

解决方案

在你的gradle.properties中:

  javacPath = / home / mj / lib / jdk1.7.0_80 / bin / javac 


在你的build.gradle中.executable = project.property('javacPath')


I need to specify the path to javac in my gradle project. I can do this by adding the following to my build.gradle file:

options.forkOptions.executable = '/home/mj/lib/jdk1.7.0_80/bin/javac'

The problem is that this file is shared in our repository and I do not want the setting to get pushed there. I tried putting it in my local gradle.properties file, but it didn't work. Also setting gradle.java.home does not affect this. I guess it's because gradle uses gradle.java.home for java and not for javac, right? I also (hopelessly) tried setting a gradle.jdk.home which (not surprisingly) didn't work either!

Is there any place outside the project that is included in build.gradle?

解决方案

In your gradle.properties:

javacPath=/home/mj/lib/jdk1.7.0_80/bin/javac

In your build.gradle

options.forkOptions.executable = project.property('javacPath')

这篇关于在用户的gradle.properties中设置JDK home(javac路径)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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