On 08/13/2010 06:35 AM, Andrey Pavlenko wrote:
Exporting properties and references from a sub-project to its parent project

This is something I struggled with in NetBeans-generated Java projects. I wanted to permit build scripts to call dependencies recursively without reentering any dependencies during a single build (and maintaining locality of information: a script knows only about its own direct dependencies). The natural idea is to just set a property mentioning ${basedir} when building one project and exit early if it is already set, but this does not work since properties set in a child cannot be propagated to the parent. The ugly workaround I found was to create a properties file in a build dir when building the topmost project, passing its location to children, and loading and saving it from each build. Obviously this involves otherwise unnecessary file I/O and is very hard to follow, especially considering that it is tricky to load properties in an isolated namespace in Ant, and "if (...) return;" is impossible from the dependency so a subbuild can be skipped only from the depending script.

http://hg.netbeans.org/main-silver/diff/c01e2c997e19/java.j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl

The lesson I draw is that Ant without <script> is ill suited to even moderately 
complex builds.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org

Reply via email to