Skip to content
This repository has been archived by the owner on Oct 3, 2019. It is now read-only.
jvshahid edited this page Jan 30, 2011 · 9 revisions

Usage

Adding transitive dependencies to your project

Assuming that foo:bar:jar:1.1 depends on foo:foobar:jar:1.0

require 'buildr-dependency-extensions'

repositories.remote << "http://www.ibiblio.org/maven2/"

define 'foo-bar' do
  extend TransitiveDependencies

  # define the project-version
  project.version = '1.0.0'

  project.transitive_scopes = [:compile, :run]

  compile.with artifact('foo:bar:jar:1.1')
  run.with artifact('foo:foobar:jar:1.1')
end

In this example the runtime dependencies will be foo:bar:jar:1.1 and foo:foobar:jar:1.1 For more information about dependency management see Dependency Management.

Adding pom generation

require 'buildr-dependency-extensions'

repositories.remote << "http://www.ibiblio.org/maven2/"

define 'TestProject' do
  extend PomGenerator

  project.version = '1.0-SNAPSHOT'
  project.group = 'foo.bar'
  run.with ['foo:bar:jar:1.0']
  compile.with ['foo:foobar:jar:1.0']
end
<?xml version="1.0" encoding="UTF-8"?>
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>foo.bar</groupId>
  <artifactId>TestProject</artifactId>
  <version>1.0-SNAPSHOT</version>

  <dependencies>
    <dependency>
      <groupId>foo</groupId>
      <artifactId>bar</artifactId>
      <version>1.0</version>
      <scope>runtime</scope>
      <type>jar</type>
    </dependency>
    <dependency>
      <groupId>foo</groupId>
      <artifactId>foobar</artifactId>
      <version>1.0</version>
      <scope>compile</scope>
      <type>jar</type>
    </dependency>
  </dependencies>
</project>

For more information about customizing the generated pom see Pom customization.