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.
To add a Gradle plugin with dependencies, you can use code similar to the following: Plugin DSL GA versions. Plugin DSL non GA versions. Legacy Plugin Application.
From inside the new project directory, run the init task using the following command in a terminal: gradle init . When prompted, select the 2: application project type and 3: Java as implementation language. Next you can choose the DSL for writing buildscripts - 1 : Groovy or 2: Kotlin .
The subproject producer defines a task named buildInfo that generates a properties file containing build information e.g. the project version. You can then map the task provider to its output file and Gradle will automatically establish a task dependency.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With