问题
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
andtargetCompatability
properties...applying the
idea
plugin to Gradle and settingidea.project.jdkName
tonull
.
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