Maybe the choice of some IDE’s to make their CLI’s not to adopt project specific variables may be on purpose, since this would force devs to use the tools provided by their IDE’s instead of going their merry way, this product over-dependance mindset is a core principle of our current economic system.
And to me… this seems fair, they can do whatever they want with their service… the issue is that in some cases… official documentation from those same IDE’s sends you straight to the vendors/provider’s documentations.
So, in the case specifically of IntelliJ, I’d like to know how to use IntelliJ’s own command line interface so that commands like ./gradlew
, make use of the same internal environment settings that the IDE has set up for the project.
Here is a more detailed scenario to help explain my point:
When I use a Gradle plugin, a UI menu appears, this menu will contain Gradle actions, the type one would usually perform via CLI commands.
Instead of typing ./gradlew -build
in the project directory, now I just need to press “build” in the Gradle tool window.
You press “build” even with a local SDK (project embedded) and it works.
If you try to build via IntelliJ’s CLI an error will appear:
paraphrasing: “No JAVA_HOME and PATH have been set”
This means that each time the ‘build’ option is clicked on the UI, IntelliJ is setting up the necessary environment variables, including JAVA_HOME and PATH, internally. so that even if these variables are not set globally on your operating system, IntelliJ configures them for the duration of the build process.
Is there a way for the CLI to ALSO adopt these same variables? or maybe to write a special prompt that sets up variables for the duration of the CLI prompt alone?