问题
I'm fairly new to gradle and I would like to create a custom type for with the Gradle Init Plugin. Moreover, I'd like to be able to do something like:
gradle init --type jsp-library
This would generate a project directory with the same structure as a Java web application (webapp, stylesheets, etc...). Yes, I have read this, and I know that only a limited amount of types are available. I just want to know if someone has or knows of some sort of work around for the time being.
回答1:
There are 3rd party plugins that allow you to create custom templates and generate new projects from templates. For instance, see: https://github.com/townsfolk/gradle-templates
Use maven to generate a project from archetype and then use gradle init to convert it to gradle project.
Modify the init plugin yourself from source to add more init types.
来源:https://stackoverflow.com/questions/34856834/create-custom-build-init-type-for-gradle-build-init-plugin