Just to complement Antoine's answer, it's currently not possible to
reference the parent project using project(...) since its definition is
currently not complete at the point when it's evaluated.   (Not saying it
will be like this forever, just that it's a known limitation).

Second, artifact(...) is only necessary for files you intend to get/put into
a repository at some point.  Otherwise, you can just reference the file
directly.  It's slightly easier.

Last, another way to achieve what you want would be to write,

define "parent" do
  LIBS = _('libs')
  ...
  define "child" do
    compile.with File.join(LIBS, 'foo.jar')
  end
end

alex


On Sat, Aug 28, 2010 at 9:43 AM, Antoine Toulme <[email protected]>wrote:

> I just committed a test (in SVN) to show how to do it.
>
> The secret words are "project.parent".
>
> On Sat, Aug 28, 2010 at 08:23, Mark Petrovic <[email protected]> wrote:
>
> > I have a project consisting of a parent and a child.  The child needs a
> jar
> > artifact outside its directory space, but within the parent's space.
>  E.g.
> >
> > parent
> >        lib/thejar.jar
> >        child
> >                src/main/java
> >                etc.
> >
> > I have a working child build, referring to the thejar.jar thusly
> >
> > compile.with
> > artifact('thegroup:thearti:jar:beta').from(file("../lib/thejar.jar"))
> > ...
> >
> > but I don't like the ../lib in the path.
> >
> > I tried things like project("parent")._("lib/thejar.jar") ... but kept
> > getting circular dependency errors.
> >
> > What is the Buildr Way to refer to the thejar.jar that is in a well-known
> > location relative to the parent, but not necessarily the child?
> >
> > Thanks.
> >
> > --
> > Mark Petrovic
> >
> >
> >
>

Reply via email to