I'm almost done with my Gradle Templates plugin. All the information on how to use it can be found on it's wiki page. All that's really needed now is to finish up the Scala support.
I'm pretty happy with the result. The plugin supports all the built in Gradle plugins: Java, Groovy, War (webapp), and soon Scala. It also has tasks for starting your own standalone Gradle Plugin.
It's my hope that this plugin will be helpful to others getting started with the Gradle build system.
A Quick Start:
To start using the plugin you need to have Gradle, and Bazaar VCS installed.
Then you install the plugin by downloading the source and running the 'installPlugin' task.
Or if you prefer Git, there is a github mirror.
Then run the installPlugin task in the newly checked out project.
Usually, I do all my development work in a directory under my home directory like so:
apply plugin: "templates"
This provides me with the following "Template" tasks (running 'gradle tasks').
As explained in the wiki, the 'create*Project' tasks are intended for creating new projects, and new directories. The 'init*Project' tasks are intended to be used within a previously created directory where you want to set this directory up as a new Gradle project.
So, to get started with your own webapp, you can now run 'gradle createWebappProject'.
Answer a few basic questions:
[503] gradle createWebappProject
> Building > :createWebappProject
??> Project Name: TestWebappProject
??> Use Jetty Plugin? (Y|n)[n] y
:createWebappProject
BUILD SUCCESSFUL
Total time: 13.207 secs
And you're done. You can 'cd' into your new project and run 'gradle jettyRun' and have your webapp up and running on port 8080 in no time.
Cheers, and happy coding. :)
Eric
I'm pretty happy with the result. The plugin supports all the built in Gradle plugins: Java, Groovy, War (webapp), and soon Scala. It also has tasks for starting your own standalone Gradle Plugin.
It's my hope that this plugin will be helpful to others getting started with the Gradle build system.
A Quick Start:
To start using the plugin you need to have Gradle, and Bazaar VCS installed.
Then you install the plugin by downloading the source and running the 'installPlugin' task.
bzr branch lp:gradle-templates
Or if you prefer Git, there is a github mirror.
Then run the installPlugin task in the newly checked out project.
gradle installPlugin
Usually, I do all my development work in a directory under my home directory like so:
/home/elberry/development/projects
So to use the 'create*Project' tasks, I've created a build.gradle file under my 'projects' directory, which simply contains the following:apply plugin: "templates"
This provides me with the following "Template" tasks (running 'gradle tasks').
Template tasks
--------------
createGradlePlugin - Creates a new Gradle Plugin project in a new directory named after your project.
createGroovyClass - Creates a new Groovy class in the current project.
createGroovyProject - Creates a new Gradle Groovy project in a new directory named after your project.
createJavaClass - Creates a new Java class in the current project.
createJavaProject - Creates a new Gradle Java project in a new directory named after your project.
createScalaClass - Creates a new Scala class in the current project.
createScalaProject - Creates a new Gradle Scala project in a new directory named after your project.
createWebappProject - Creates a new Gradle Webapp project in a new directory named after your project.
initGradlePlugin - Initializes a new Gradle Plugin project in the current directory.
initGroovyProject - Initializes a new Gradle Groovy project in the current directory.
initJavaProject - Initializes a new Gradle Java project in the current directory.
initScalaProject - Initializes a new Gradle Scala project in the current directory.
initWebappProject - Initializes a new Gradle Webapp project in the current directory.
--------------
createGradlePlugin - Creates a new Gradle Plugin project in a new directory named after your project.
createGroovyClass - Creates a new Groovy class in the current project.
createGroovyProject - Creates a new Gradle Groovy project in a new directory named after your project.
createJavaClass - Creates a new Java class in the current project.
createJavaProject - Creates a new Gradle Java project in a new directory named after your project.
createScalaClass - Creates a new Scala class in the current project.
createScalaProject - Creates a new Gradle Scala project in a new directory named after your project.
createWebappProject - Creates a new Gradle Webapp project in a new directory named after your project.
initGradlePlugin - Initializes a new Gradle Plugin project in the current directory.
initGroovyProject - Initializes a new Gradle Groovy project in the current directory.
initJavaProject - Initializes a new Gradle Java project in the current directory.
initScalaProject - Initializes a new Gradle Scala project in the current directory.
initWebappProject - Initializes a new Gradle Webapp project in the current directory.
As explained in the wiki, the 'create*Project' tasks are intended for creating new projects, and new directories. The 'init*Project' tasks are intended to be used within a previously created directory where you want to set this directory up as a new Gradle project.
So, to get started with your own webapp, you can now run 'gradle createWebappProject'.
Answer a few basic questions:
[503] gradle createWebappProject
> Building > :createWebappProject
??> Project Name: TestWebappProject
??> Use Jetty Plugin? (Y|n)[n] y
:createWebappProject
BUILD SUCCESSFUL
Total time: 13.207 secs
And you're done. You can 'cd' into your new project and run 'gradle jettyRun' and have your webapp up and running on port 8080 in no time.
Cheers, and happy coding. :)
Eric
For people coming here from Google: the source code is not at https://github.com/townsfolk/gradle-templates
ReplyDelete