Hi Sebastiano,

You should add package(:jar) to your ATGDUST project.   Dependency between
projects is achieved "exporting" packages to other projects.

i.e.,  when you specify compile.with project('ATGDUST'), then Buildr
internally resolves the packages of ATGDUST and picks up the .jar
dependencies.

If you don't want to export a package, then
using project('ATGDUST').compile.target is the recommended approach.

alex


On Fri, Feb 4, 2011 at 3:03 AM, Sebastiano Pilla <[email protected]> wrote:

> I want to compile a Java project which depends on the .class files produced
> by compiling another project. Both projects use a custom layout, which works
> fine, and both projects compile to their target/classes directory; there are
> no artifacts, such as JAR files, and I would like to avoid them if possible.
>
> The following does not work:
>
> define 'ATGDUST' do
>    compile.dependencies = ATG_DAS + COMMONS_CODEC + COMMONS_DBCP +
> COMMONS_LANG + COMMONS_IO + COMMONS_POOL +
>                           HSQLDB + DDLUTILS + JUNIT + LOG4J
>  end
>
>  define 'ATFramework' do
>    compile.dependencies = ATG_DAS + ATG_DPS + ATG_DSS + ATG_DCS +
> COMMONS_LANG + COMMONS_COLLECTIONS + EASYMOCK + JUNIT
>    compile.with project('ProgiCommerce:ATGDUST')
>  end
>
> The error is:
>
> D:\dev\progicommerce\src>%JRUBY_HOME%\bin\jruby -S buildr
> (in D:/dev/progicommerce/src, development)
> D:/dev/progicommerce/src/buildfile:4 warning: already initialized constant
> VERSION
> D:/dev/progicommerce/src/buildfile:7 warning: already initialized constant
> VERSION
> Building ProgiCommerce
> Compiling ProgiCommerce:ATGDUST into
> D:/dev/progicommerce/src/ATGDUST/target/classes
>
> ...
>
> 11 warnings
> Compiling ProgiCommerce:ATFramework into
> D:/dev/progicommerce/src/ATFramework/target/classes
> D:\dev\progicommerce\src\ATFramework\src\main\java\com\progiweb\testing\repository\AutoInitializingGSA.java:10:
> cannot find symbol
> symbol  : class InitializingGSA
> location: package atg.adapter.gsa
> import atg.adapter.gsa.InitializingGSA;
>                      ^
>
> ...
>
> 44 errors
> 2 warnings
> Buildr aborted!
> ?[31mRuntimeError : Failed to compile, see errors above?[0m
>
> I confirmed by adding --trace that the ATGDUST/target/classes directory
> does not appear in the compilation classpath of the ATFramework project.
>
>
> I can successfully compile both projects I change the definition of the
> ATFramework project to:
>
> define 'ATFramework' do
>    compile.dependencies = ATG_DAS + ATG_DPS + ATG_DSS + ATG_DCS +
> COMMONS_LANG + COMMONS_COLLECTIONS + EASYMOCK + JUNIT
>    compile.with project('ProgiCommerce:ATGDUST')._(:target, :main,
> :classes)
>  end
>
>
> I don't like it because I'm expressing a dependency in terms of physical
> files and not in terms of projects, but at this stage I cannot find a better
> way to do it. I feel however that I'm missing something and that Buildr
> looks flexible enough to achieve what I want, only I don't know how to do
> it. Any suggestion is appreciated.
>
> Sebastiano
>
>

Reply via email to