You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Nikos Maris <ni...@gmail.com> on 2010/08/24 23:59:27 UTC

multi-project directory structure

Based on doc <http://buildr.apache.org/projects.html#dir_structure>, the
directory structure is
killer-app/
__buildfile
__la-web/
__teh-api/
__teh-impl/

where buildfile is:
define 'killer-app', :version=>"1.0.0" do
  define 'teh-api', :version=>"1.0.0" do end
  define 'teh-impl', :version=>"1.0.0" do end
  define 'la-web', :version=>"1.0.0" do
    compile.with projects('teh-api', 'teh-impl')
    eclipse.natures 'org.eclipse.jdt.core.javanature'
    eclipse.builders 'org.eclipse.jdt.core.javabuilder'
    eclipse.classpath_containers
'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6'
  end
end

How would the buildfile change, if I moved buildfile to la-web?

Regards,
Nikos

Re: multi-project directory structure

Posted by Ed Smiley <es...@ebrary.com>.
One of the essential approaches to simplifying the build process is using convention over configuration, so if you use the Buildr conventions, you get rewarded by not having much code at all to do the needful.
If you try to do something really oddball you will--if you can get it  to work at all--end up with a much more complicated buildfile than necessary.  The basic idea is that subprojects are part of a hierarchy, have their files in certain places etc.

If you do have an existing project that you want to support (typical case is a Java project with source in "src") you can tweak Buildr to work for you.  For example, you can use child layouts to swap to a non-standard source or even target.
Here's a snippet of three child tasks, where child3 subproject has NOT been converted to the standard src/main/java convention:


..
  child_layout = Layout.new                    #<=============
  child_layout[:source, :main, :java] = 'src'  #<=============
  child_layout[:target, :main] = 'build_dir'   #<=============
  define "child1" do
    compile.with # Add classpath dependencies
    package(:jar)
  end
 
  define "child2" do
    compile.with # Add classpath dependencies
    package(:jar)
  end
 
  define "child3", :layout=>child_layout do     #<=============
    compile.with # Add classpath dependencies
    package(:jar)
  end
...


On Aug 24, 2010, at 3:05 PM, Antoine Toulme wrote:

> It wouldn't work.
> 
> On Tue, Aug 24, 2010 at 14:59, Nikos Maris <ni...@gmail.com> wrote:
> 
>> Based on doc <http://buildr.apache.org/projects.html#dir_structure>, the
>> directory structure is
>> killer-app/
>> __buildfile
>> __la-web/
>> __teh-api/
>> __teh-impl/
>> 
>> where buildfile is:
>> define 'killer-app', :version=>"1.0.0" do
>> define 'teh-api', :version=>"1.0.0" do end
>> define 'teh-impl', :version=>"1.0.0" do end
>> define 'la-web', :version=>"1.0.0" do
>>   compile.with projects('teh-api', 'teh-impl')
>>   eclipse.natures 'org.eclipse.jdt.core.javanature'
>>   eclipse.builders 'org.eclipse.jdt.core.javabuilder'
>>   eclipse.classpath_containers
>> 
>> 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6'
>> end
>> end
>> 
>> How would the buildfile change, if I moved buildfile to la-web?
>> 
>> Regards,
>> Nikos
>> 


Re: multi-project directory structure

Posted by Antoine Toulme <an...@lunar-ocean.com>.
It wouldn't work.

On Tue, Aug 24, 2010 at 14:59, Nikos Maris <ni...@gmail.com> wrote:

> Based on doc <http://buildr.apache.org/projects.html#dir_structure>, the
> directory structure is
> killer-app/
> __buildfile
> __la-web/
> __teh-api/
> __teh-impl/
>
> where buildfile is:
> define 'killer-app', :version=>"1.0.0" do
>  define 'teh-api', :version=>"1.0.0" do end
>  define 'teh-impl', :version=>"1.0.0" do end
>  define 'la-web', :version=>"1.0.0" do
>    compile.with projects('teh-api', 'teh-impl')
>    eclipse.natures 'org.eclipse.jdt.core.javanature'
>    eclipse.builders 'org.eclipse.jdt.core.javabuilder'
>    eclipse.classpath_containers
>
> 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6'
>  end
> end
>
> How would the buildfile change, if I moved buildfile to la-web?
>
> Regards,
> Nikos
>