Configuring JDK in New Project from Existing Sources

I've implemented, per the Gradle samples, a new Project from Existing Sources set of functionality for our custom directory layout. It's primarily working perfectly, except I'm not sure where I should be setting the JDK for the project / modules.

Currently, all the work is being done in my implementation of `ExternalSystemProjectResolver`, which correctly creates the modules, and sets up dependencies on external libraries and cross-module dependencies. However, if I set a Project SDK there or a Module SDK via

projectDataNode.createChild(ProjectSdkData.KEY, new ProjectSdkData(settings.getJdkName()));

ModuleSdkData moduleSdk = new ModuleSdkData(sdk.getData().getSdkName());
moduleNode.createChild(ModuleSdkData.KEY, moduleSdk);

I get an error that says that ProjectSdkData / ModuleSdkData are not Serializable. Also, I've noticed you can't hit the Jdk Table classes from that point, so I'm assuming I'm attempting to setup JDKs at the wrong point in the flow.

Where should I be setting up the JDK?

Please sign in to leave a comment.