Unable to create a custom maven based module type

已回答

Hi

Sorry for such a long question. Unfortunately I couldn't find any similar cases (with an answer) in the forum.

I'm working on a plugin for Eclipse MicroProfile Starter. It's mainly a module type plugin that displays the following form in the new project wizard:

 

I've added a custom ModuleBuilder which inside its setupRootModel submits form data to a REST API and fetches a maven module as a zip file (generated on the fly). The zip file then gets extracted in a temp folder and copied into the root folder of the project

My guess is that the last step (to unzip and copy the contents directly to the project folder) is probably wrong and there should be an interface/class in Maven plugin that can be called/implemented to do this.

The main problem is, when files gets copied, Maven plugin detects that the pom.xml and other files have changed and a notification pops up asking user to Import the Maven project again. At the same time the following modal message also appears on screen:

This is because my implementation of the ModuleBuilder overwrites the getModuleType method and returns its custom module type (that has a dedicated Icon and label in new project wizard).

If I click on the Recreate button, it changes the module type to Maven and everything works fine.

So I think there should be a way to ask Maven plugin manually to do this recreation process or implement the unzip/copy/import process via Maven plugin API so that it does the same actions that happens when we press the Recreate.

I tried to utilize MavenImporter, but I was not successful and I'm not sure if it supposed to be used for this purpose. 

It's important to have the Microprofile in the project wizard as a separate module type.

 

Regards

Ehsan

0

If you do not really need a custom module type, you can simply override com.intellij.ide.util.projectWizard.ModuleBuilder#getNodeIcon + getDescription + getPresentableName and return StdModuleTypes.JAVA from getModuleType to customize the appearance in the wizard.

1

Thank you Yann.

That really solved my problem :)

0

请先登录再写评论。