Create another module when creating project using plugin



Am creating a plugin that extends new project wizard.

I need to create sub-module for "app" module that is created by default, so that when the project is created I should have 2 modules

1. "app" module

2. submodule for "app" module.


Kindly let me know how this can be implemented.


Hi Sharanya,

In order to create a default module, you have to create a new module type by extending  com.intellij.ide.util.projectWizard.ModuleBuilder class and register it in plugin.xml using moduleType tag. For sample Implementation, check org.jetbrains.idea.maven.wizards.MavenModuleBuilder.

In the ModuleBuilder class there is a method called 

moduleCreated(@NotNull Module var1)

This method is called after module structure is completely built. Within this method, you can manually create "app" module for the project.

I'm not sure why you want to create a sub module within "app" module. You can add it as another module to the project.


Hi @sajith dilshan, so the moduleCreated function will only be called once when the project is imported or created, It will not be called again when you reopen the project right?


@jihui Zheng No. the ModuleCreated() method will be only invoked when a new module is created. 


Please sign in to leave a comment.