0

I have made a Project Wizard in the intellij plugin im making, now what I want to do at the end of that is make it generate the src/main/java, or src/main/kotlin, depending on the data provided in the project wizard ive made. I also want it to make this as a gradle project. If anyone knows how to do this that would be much appreciated. Thankyou

Aj3douglas
  • 51
  • 1
  • 7

1 Answers1

0

If you want to IDE recognize the project as a gradle project you must generate gradle files(build.gradle, settings.gradle and etc) based on this doc. and after generating finished you must call sync gradle with this line of code inside your ide-plugin.

ExternalSystemUtil.refreshProject(
        project,
        ProjectSystemId("GRADLE"),
        "YOUR_PROJECT_PATH",
        false,
        ProgressExecutionMode.IN_BACKGROUND_ASYNC
)

Hope this help

Mehdi Yari
  • 481
  • 3
  • 12
  • How do I generate the src/main/java folders and whatnot? – Aj3douglas Feb 26 '21 at 23:10
  • It's simple just get the project path from `Project` class and crate folder with java or kotlin File API. https://stackoverflow.com/questions/3634853/how-to-create-a-directory-in-java – Mehdi Yari Feb 27 '21 at 08:13
  • Oh, was just wondering if there was a fancy way to do that with the intellij api, how do i mark it as the src dir and whatnot? – Aj3douglas Feb 28 '21 at 01:26