How to remove the java standard library from a gradle project?

坚强是说给别人听的谎言 提交于 2019-12-24 00:52:26

问题


How can one make Gradle not include the Java standard library as a dependency to IntelliJ IDEA project?

I am using IntelliJ and every time I Refresh all Gradle projects:

IntelliJ adds the Java standard library back to the project as an external dependency:

So I have to manually remove it every single time:

Things I tried that didn't work out

  • fiddling with the sourceCompatibility and targetCompatability properties...

  • applying the idea plugin to Gradle and setting idea.project.jdkName to null.

Background

  • I'm writing a program for the Lego NXT Brick

  • I'm using Lejos so I can write the program in Java

  • Lejos' "standard library" for the Lego brick is only a fraction of the actual Java standard library....(because of memory constraints?)

  • Lejos provides a JAR file that contains all the classes of their standard library to assist in programming. I've added this JAR as a dependency of the project.

  • Gradle also (implicitly?) adds the actual java standard library as a dependency to the project, which obscures Lejos' standard library classes since they use the same names...

P.S. at least this is what I think is happening....please correct me if I'm wrong


回答1:


You better create a user variable like %JAVAHOME% in enivronment variables and give it in path in the system variables. use 1.7 in javahome and 1.8 in javahomeb when you want 1.8 just rename the variable



来源:https://stackoverflow.com/questions/38786992/how-to-remove-the-java-standard-library-from-a-gradle-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!