Oh, Gradle, You Made My Heart Skip a Beat
As I just mentioned, I’ve been working on some Gradle plugins. I’ve been using Gradle in my polyglot programming book, and there’s a stunt (namely, running Cucumber in a Java/Groovy/Scala build) that I’d like the user to be able to do without too much hassle. The easiest way is to say, “Hey, use this plugin and let the magic fly”.
In doing development, I’m spending some time pushing through integration tests, and in so doing, I wanted to deploy various versions to a Maven repository and pull them back down.
Creating a Maven repository for SmokejumperIT was pretty simple.
- Create a space on the internet for the repository which is accessible via public-key-authenticated SCP. In my case, it’s http://repo.smokejumperit.com.
- Create a configuration in the Gradle build file for the JARs needed to deploy:
configurations { deployerJars } repositories { mavenRepo urls: "file://${System.properties['user.home']}/.m2/repository/" mavenCentral() } dependencies { deployerJars 'org.apache.maven.wagon:wagon-ssh:1.0-beta-2' }
Note: The part in the
repositoriesblock is in every build file that I have, so I’m working on a plugin (working titlePreconfigPlugin) that will automatically add that in. - Configure the
uploadArchivestask. I had it delegate to variousSystemproperties that I set when I run the build script.uploadArchives { repositories.mavenDeployer { def repoUser = System.properties['sjit.repo.user'] configuration = configurations.deployerJars repository(url: "scp://repo.smokejumperit.com/home/$repoUser/repo.smokejumperit.com/") { authentication( userName: repoUser, privateKey: new File(System.properties['sjit.repo.keyFile']).absolutePath, passphrase: System.properties['sjit.repo.passphrase'] ) pom { groupId='com.smokejumperit' artifactId='gradle-plugins' version='0.2-SNAPSHOT' } } } }
- Run
gradle upload.
That’s all it took. Even better, it does all the funky snapshot management on its own: see http://repo.smokejumperit.com/com/smokejumperit/gradle-plugins/0.2-SNAPSHOT/ for the beautiful timestamped results!
This is how builds should be: stupid-simple to do the right thing.
Comments
- November 27, 2009, Hamlet D'Arcy wrote: I'd like to hear what you think about Gradle being the result of applying Evans-style Domain Driven Design to build systems. Is a strong domain model for enterprise projects really a great benefit?
- March 23, 2010, Blog bookmarks 03/24/2010 « My Diigo bookmarks wrote: [...] Oh, Gradle, You Made My Heart Skip a Beat [...]
This post was by Robert Fischer, written on November 27, 2009.
Comment on this post: http://enfranchisedmind.com/blog/posts/gradle-maven-repo-snapshots/#respond
Public Permalink: http://enfranchisedmind.com/blog/posts/gradle-maven-repo-snapshots/

This article was a post on the EnfranchisedMind blog. EnfranchisedMind Blog by Robert Fischer, Brian Hurt, and Other Authors is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.
About Robert Fischer
Robert Fischer is a multi-language open source developer currently specializing in Groovy in Grails. In the past, his specialties have been in Perl, Java, Ruby, and OCaml. In the future, his specialty will probably be F# or (preferably) a functional JVM language like Scala or Clojure.
Robert is the author of Grails Persistence in GORM and GSQL, a regular contributor to GroovyMag and JSMag, the founder of the JConch Java concurrency library, and the author/maintainer of Liquibase-DSL and the Autobase database migration plugin for Grails.
More About Robert »Why Attend the NFJS Tour?
- » Cutting-Edge Technologies
- » Agile Practices
- » Peer Exchange
Current Topics:
- Languages on the JVM: Scala, Groovy, Clojure
- Enterprise Java
- Core Java, Java 7
- Agility
- Testing: Geb, Spock, Easyb
- REST
- NoSQL: MongoDB, Cassandra
- Hadoop
- Spring 3
- Automation Tools: Git, Hudson, Sonar
- HTML5, Ajax, jQuery, Usability
- Mobile Applications - iPhone and Android
- More...
NFJS, the Magazine
May Issue Now AvailableClient-Side MVC with Spine.js, Part 1
by Craig WallsOn Prototypal Inheritance, Part 2
by Raju GandhiMaking use of Scala Lazy Collections
by Venkat SubramaniamIntegration Testing Web Applications Using Gradle
by Kenneth Kousen


