GenerateModuleFromTemplate
GenerateModuleFromTemplate copied to clipboard
An IntelliJ platform IDEs plugin use for create module from a highly customizable template
Generate Module From Template
Create a directory structure from a highly customizable template
Using this plugin, help you create directories and files from the customizable template.
Feature
- Custom directory structure.
- Support placeholders / ApacheVelocity template language, and replace it when you create a module.
- Specify file templates from IDE custom/build-in templates.
- Passing placeholders to file template as variables.
- Output/import template file. share your template with your partner.
Usage
- Configure template in plugin settings: File > Settings > Tools > Module Template Settings.
- Create directories from the 'Structure' tab, click the right mouse button to operate the file tree.
- FileTree can use placeholders / ApacheVelocity template language , the placeholder should like this -> ${YOUR_PLACEHOLDER_HERE}.
- The 'File Template' tab lists which template the specified file uses, you can also use placeholders / attributes for FileName field.
- The 'Placeholder' tab's table defines placeholders / attributes for replacing filenames and file templates
NOTE
- The nested placeholder in dir tree will be calculated and merged to a new placeholder, eg:
${${A}_${B}}, A=a, B=b,result=${a_b}. - The existing files will be skipped.
- The Java class file name may depend on ClassName, you better keep the class name and file name consistent, else the file name in the template will not effective.
- The placeholders are best not the same as the built-in property of
Apache Velocity.
Build
Dependencies
- JDK 8+
- Kotlin
- IntelliJ IDEA (Community Edition) 19.1+
Import Project
This project is not a gradle or pom project, but a IntelliJ Platform Plugin project, IDEA cannot import this project normally.
In IDEA Community (
necessary) File -> New -> Project from Exsiting Sources -> Create project from exsiting sources, then click next
until finish import.
Pressing the Ctrl + Alt + Shift + S to open Project Structure dialog, choose Project tab, change Project
SDK to IntelliJ IDEA Community Edition IC-xxxx, then apply change.
Then, edit GenerateModuleFromTemplate.iml in the project root directory, change the type attribute of module node
to PLUGIN_MODULE, minimize the IDEA and restore it, the plugin project will be detected.
Finally, Run -> Edit Configuretions -> Alt + Insert -> Plugin -> Apply, the project configuration completed.
Generate Plugin Jar
Run -> Prepare Plugin Module xxx For Deployment
Changelog
- 1.5.0: Fix: specify a template doesn't work., feature: fetch template variables as placeholders when create the file, support specify file template when create the module. ui looks more comfortable.
- 1.4.0: feature: Support export and import template to file, adjust action button position.
- 1.3.1: fix: AucFrame module template bugs.
- 1.3.0: fix: Placeholder don't work when call FileTreeNode.include.
- 1.2.0: feature: all IntelliJ platform IDEs support, file template selection support when edit module template.
- 1.1.0: feature: support create module template, placeholder, file template
- 1.1.0: feature: support create module template, placeholder, file template 1.0: basically feature, generate module directories from template
- 1.0.0: basically feature, generate module directories from template
Screenshot