This post originated from an RSS feed registered with Java Buzz
by dion.
Original Post: Checking my maven repository with Groovy
Feed Title: techno.blog(Dion)
Feed URL: http://feeds.feedburner.com/dion
Feed Description: blogging about life the universe and everything tech
I am finding myself grabbing Groovy rather than Perl for some of those small scripting tasks that you run into.
One I ran into recently revolved around my maven repository.
We setup our own Maven repo (we don't want to keep hitting the poor ibiblio site!), and whenever we add dependencies, we grab the files from ibiblio and put them in our own repo.
However, it is easy to forget, so I whipped up a script that will check the dependencies in our project.xml and make sure those files exist in the repo, else it will shout at me to do the move.
It would also be cool to have it automatically do the copy itself!
I really like how you can whip through XML
Groovy Maven Script
#!/bin/env groovy
# -----------------------------------------------------------------------------
# mavenTestRepository.g: Take a given project.xml and a Maven repo, shout out
# which files are there, and which are not
# -----------------------------------------------------------------------------
import groovy.util.XmlParser
import java.io.File
# -- Enforce the project.xml and dir
if (args.length 0) {
println "\n-----------------------------------------------------------------------"
println "Dependencies not in the repository:\n"
badFiles.each { println it }
}