On Tue, Dec 8, 2009 at 12:00 PM, Jeremy Huiskamp <
[email protected]> wrote:

> I've noticed that the pom.xml generated by the upload task and placed in
> the target maven repository doesn't include dependency information, which is
> kind of a pain when my maven-using colleagues want to use libraries I've
> built with buildr and they have to go and list all of my dependencies
> explicitly.  Can the pom generation include a list of artifacts and, if so,
> how can I specify it?  I'd be fine with handcrafting a pom.xml and having
> the task use that instead of a generated one but doing it in the buildfile
> would be nicer.
>

To provide your own pom.xml:

package(:jar).pom.from _("pom.xml")

If you want to craft a pom from within your buildfile, do can do something
along the lines of

  file("target/pom.xml") do |file|
    pkg = package(:jar)
    File.open(file.to_s, 'w') do |file|
      xml = Builder::XmlMarkup.new(:target=>file, :indent=>2)
      xml.project do
        xml.modelVersion '4.0.0'
        xml.groupId pkg.group
        xml.artifactId pkg.id
        xml.version pkg.version
        # add more information ...
      end
    end
  end
  package(:jar).pom.from _("target/pom.xml")

Hope this helps,
alex

Reply via email to