Programmatically Set Default Project SDK in IntelliJ

79 views Asked by At

I am trying to setup IntelliJ and maven project on multiple machines. I used Powershell to programmatically install IntelliJ on the machines and download the maven project repo. I also programmatically downloaded JDK and set JAVA_HOME to point to it.

When I open the maven project in IntelliJ, the default project SDK is not set. I need to manually go to Project Structure > Project Settings > Project and then point to the installed JDK on the machine. Is there a way to programmatically set the IntelliJ default project SDK to the installed JDK (referenced by the JAVA_HOME path) on the machine using the command line, so that when I open the maven project in IntelliJ the default project SDK is already set? I’d like to avoid manually going to project structure and setting the SDK using the IntelliJ UI.

For reference, I am using IntelliJ IDEA 2023.1.2 x64

I tried searching for command line operations that can be invoked on IntelliJ to set the default project SDK but couldn’t find any.

0

There are 0 answers