当前位置:   article > 正文

gradle设置java home,在用户的gradle.properties中设置JDK home(javac路径)

gradle中javahome修改

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')

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/秋刀鱼在做梦/article/detail/962456
推荐阅读
相关标签
  

闽ICP备14008679号