buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc-André Laverdière <marcandre.laverdi...@gmail.com>
Subject Generating dependencies in pom file
Date Thu, 10 Mar 2011 12:07:23 GMT
Hello everyone,

I am not strong enough in Ruby to create an extension, but I thought
it would be trivial for someone on the mailing list

Here is the code that converts artifacts into a pom file:

    Mustache.template_file = 'pomtemplate.mustard'
    pom = Mustache.new
    pom[:group] = project.group
    pom[:artifact] =  project.id
    pom[:version] = project.version
    pom[:dependencies] = alldeps.map{|x| Artifact.to_hash(x)}
    File.new(pom_file, "rw").write pom.render
    puts "Generated POM file in " + pom_file

The mustache template is as follows

<?xml version="1.0" encoding="UTF-8"?>
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>{{group}}</groupId>
  <artifactId>{{artifact}}</artifactId>
  <version>{{version}}</version>

  <dependencies>
{{#dependencies}}
    <dependency>
      <groupId>{{group}}</groupId>
      <artifactId>{{id}}</artifactId>
      <version>{{version}}</version>
    </dependency>
{{/dependencies}}
  </dependencies>
</project>:

I think it would be very useful to have POMs with the deps. I am
working with a in-house lib, and it breaks a lot of buildr files
whenever we update one dependency.
When could we have it in production?

Regards,

Marc-André LAVERDIÈRE
"Perseverance must finish its work so that you may be mature and
complete, not lacking anything." -James 1:4
http://asimplediscipleslife.blogspot.com/
mlaverd.theunixplace.com

Mime
View raw message