--- Michael Wenig <[EMAIL PROTECTED]> wrote: > I have a script which builds distributables for 2 systems (production > and test-system). > Which system will be used depends on command-line-called target. Because > there are differences between these distributables (e.g. > deployment-descriptors) I want to include the target given on > command-line in the name of the resulting jar/war, without using another > internal target to pack - this would result in much redundancy. > > I thought of a built-in-property like ant.project.name so I can use > > <jar jarfile="${dist}/project-${ant.target.name}.jar" > basedir="${dest}"/> > > so calling "ant test" would result in "project-test.jar" and calling > "ant production" would result in "project-production.jar" without > defining two different targets which do the packing. > > Does anyone know if this is possible?
There isn't a built-in property for the target, but you could do something in .antrc (which the 'ant' script processes): for arg in $* { [ "$targetset" ] && { echo "Error: Only one of production | test may be specified." exit 1 } case $arg in production) export ANT_OPTS="$ANT_OPTS -Dtarget=$arg" targetset=true ;; test) export ANT_OPTS="$ANT_OPTS -Dtarget=$arg" targetset=true ;; esac } Of course, that's just for *nix (or Win* running *nix-type shells), so if you're on a straight Win* box, you're on your own :) Diane ===== ([EMAIL PROTECTED]) __________________________________________________ Do You Yahoo!? Send FREE Valentine eCards with Yahoo! Greetings! http://greetings.yahoo.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>