Andrey Hihlovskiy
Professional blog on groovy, gradle, Java, Javascript and other stuff.
Category Archives: gradle
Meet Gretty: advanced gradle plugin for running web-applications under Jetty and Tomcat
June 14, 2013
Posted by on I created little gradle plugin for running web-applications under Jetty 8.1.8.
The main advantage for a programmer is that now it’s possible to use servlet-api 3.0 and higher (under standard gradle-jetty plugin it was not possible, because jetty was too old).
Full sources, documentation and examples here:
https://github.com/akhikhl/gretty
Update 24.02.2014:
Now gretty supports jetty 7, 8 and 9 and servlet API 2.5, 3.0.1 and 3.1.0, as well as it brings many new interesting features!
Update 07.10.2014
Now Gretty supports Tomcat 7 and 8, as well as SpringBoot, spring-reloaded and jacoco!
Automated git-pull
June 7, 2013
Posted by on Suppose you have 20 git-repositories, which you actively pull and push from/to central location (e.g. github). Don’t you think pulling them by hand is too mechanical? And what if you forget to pull some?
I wrote little gradle script capable of automated git-pull:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
repositories { mavenCentral() } | |
dependencies { classpath 'org.ajoberstar:gradle-git:0.5.0' } | |
} | |
import org.ajoberstar.gradle.git.tasks.* | |
def onEachGitFolder(File folder, Closure closure) { | |
File gitServiceFolder = new File(folder, ".git") | |
if(gitServiceFolder.exists() && gitServiceFolder.isDirectory()) | |
closure(folder) | |
else | |
folder.eachDir { subFolder -> | |
onEachGitFolder(subFolder, closure); | |
} | |
} | |
task pull | |
onEachGitFolder projectDir, { folder -> | |
def taskName = folder.name + "_pull" | |
project.task (taskName, type: GitPull) { | |
setRepoPath folder.absolutePath | |
} | |
project.tasks.pull.dependsOn project.tasks[taskName] | |
} | |
defaultTasks "pull" |
You drink morning coffee and the machine does the job for you.
Credits come to the creators of excellent gradle-git plugin:
Script for mass checksum (MD5 and SHA1) calculation in the file system.
June 5, 2013
Posted by on I developed little gradle script, that delivers mass checksum (MD5 and SHA1) calculation for files in the specified folder (recursive to subfolders):
https://github.com/akhikhl/checksums
At the beginning that was more like exercise in using gradle for non-compilation tasks and in integrating apache-commons into gradle script.
Now, I think, I will do more gradle than bash, because gradle scripts are: a) portable b) have access to limitless power of all java libraries.
Recent Comments