What is the Gradle counterpart to Maven archetypes? How can I give other Gradle users a template for the file and directory layout for a new project?
While this is not yet supported by Gradle, the gradle:templates plugin looks promising:
Gradle don't support build-in archetype-like feature, but you can use plug-in named Gradle templates
Read more:
Does gradle have Maven archetype-like functionality?
Gradle archetypes issue
There is no gradle counterpart as far as I know. However following the steps given below is enough for most cases:
gradle init
It is supposed to work with all basic maven archetypes.
In case you are using the spring framework under Linux: You could use http://start.spring.io/ or alternatively install Spring CLI
$ curl -s "https://get.sdkman.io" | bash
$ sdk install springboot
$ spring --version
Spring Boot v1.3.5.RELEASE
$ spring init --build gradle --name test --groupId com.test
Using service at https://start.spring.io
Content saved to 'demo.zip'
$ unzip demo.zip
I'm been looking for this feature as well, and found that it's a little bit complicated to have a complex project template to work with https://github.com/townsfolk/gradle-templates.
So I created this plugin, it's quite similar with the Maven archetype function. https://github.com/orctom/gradle-archetype-plugin/
You can create generators for Yeoman, or use existing non-official ones such as JHipster. As an example there is the java-gradle generator:
npm install -g yo
- Install module globally:
npm install -g generator-java-gradle
- Generate project with:
yo java-gradle