如何从gradle项目中删除Java标准库

如何从gradle项目中删除Java标准库

本文介绍了如何从gradle项目中删除Java标准库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使Gradle不包括Java标准库作为IntelliJ IDEA项目的依赖项?

我每次使用Refresh all Gradle projects时都使用IntelliJ:

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

IntelliJ将Java标准库作为外部依赖项添加回项目中:

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

所以我必须每次都手动将其删除:

So I have to manually remove it every single time:

  • 正在使用sourceCompatibilitytargetCompatability属性...

idea插件应用于Gradle并将idea.project.jdkName设置为null.

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

我正在使用 Lejos ,所以我可以用Java编写程序

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

Lejos的标准库" 乐高积木只是实际Java标准库的一小部分....(由于内存限制?)

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

Lejos提供了一个JAR文件,其中包含其标准库的所有类,以帮助进行编程.我已将此JAR添加为项目的依赖项.

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也(隐式地)将实际的Java标准库添加为项目的依赖项,这使Lejos的标准库类变得模糊,因为它们使用相同的名称...

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.至少这是我认为正在发生的事情....如果我错了,请纠正我

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

推荐答案

您最好在环境变量中创建一个诸如%JAVAHOME%的用户变量,并将其放在系统变量的路径中.在javahome中使用1.7在javahomeb中使用1.8当您想要1.8时,只需重命名变量

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 javahomebwhen you want 1.8 just rename the variable

这篇关于如何从gradle项目中删除Java标准库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 15:13