You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by efe4it <ef...@gmail.com> on 2010/10/26 22:47:29 UTC

Needs clarification on nested behavior

Hi

I encounter some difficulties using the import/include mecanism and I need
some advice.

My environment is:
	JDK Sun-1.6.0_06
	ANT-1.8.1 with antcontrib-1.0b3 & antunit-1.1 in ANT_HOME/lib/
	
I am trying to set up a custom build environment, defining antlibs and
scriptlets to be reused across multiple projects.
I have defined some macrodefs in antlib form and assembled a JAR dropped
into ANT_HOME/lib
I am now working on thematic scriptlets, like java-project-layout,
checkstyle, ...

Next I intend define multiple template buildfile, that reference the
scriptlets target by inclusion (<include>), because I do not intend to
override the targets in the template.

These template are to be referenced by import (<import>) by the project's
buildfile.
I want to use import because some of the template's targets must be
overriden to adapt to the project's specific configuration.

For instance, my "-main-compile" target need a different classpath
configuration in every project and use the
following target as customizer:
<target name="-main-compile-additional-classpath-setup" depends="-init">
	<echo level="verbose" message="[-main-compile-additional-classpath-setup]
override this target to add external libraries" />
	<path id="id.cp.compile.main.additional" />
</target>

As ANT was complaining about missing target, I set up simpler test scenario
using two-level include/import hierarchy and a simple usage target in each
file echoing the buildfile name.
There as 4 possible configurations with child (include|import) father
(include|import) grandpa. 

See attachment  http://ant.1045680.n5.nabble.com/file/n3237790/project-02.7z
project-02.7z 

Result are summarized here
1/ build.xml -> include -> include : ok
2/ build.xml -> import -> import   : ok
3/ build.xml -> include -> import  : ko
Target "f-included#gp-imported#gp-usage" does not exist in the project
"child". It is used from target "f-included#f-usage" 
4/ build.xml -> import -> include  : ko (missing target in imported.xml)
Target "gp-included#gp-usage" does not exist in the project "child". It is
used from target "f-imported#f-usage".

Target available as displayed with "ant -p"
1/  include include: as I expected, father-prefix for father targer and
(father+grandpa)-prefix for grandpa targets
 c-usage
 included#f-usage
 included#gp-included#gp-usage

2/ import import: as I expected, no prefix for any target
 c-usage
 f-usage
 gp-usage

3/ include import: I expected to get father-prefix for father and grandpa
target but got
 c-usage
 f-included#f-usage
 gp-usage

4/ import include: I expected to get no prefix for father target and
granpa-prefix for grandpa target but got
 c-usage
 f-imported#gp-included#gp-usage
 f-usage

Any help appreciated

Regards

-- 
View this message in context: http://ant.1045680.n5.nabble.com/Needs-clarification-on-nested-import-include-behavior-tp3237790p3237790.html
Sent from the Ant - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Needs clarification on nested behavior

Posted by efe4it <ef...@gmail.com>.
Added Link to Bug report:
https://issues.apache.org/bugzilla/show_bug.cgi?id=50193


-- 
View this message in context: http://ant.1045680.n5.nabble.com/Needs-clarification-on-nested-import-include-behavior-tp3237790p3279110.html
Sent from the Ant - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org