Hi so recently I have just discovered the amazing power of Ant and I was wondering if Ant has the following capability. Let me first explain what I am trying to do... I have a product that requires different build specifications for开发者_如何学Go each build and I would hate to do it manually (the site is not live yet but I am expecting a fair amount of orders/day). I can't just build a jar for each combination of settings mostly because each jar will need to have a customer's user id and their license built in. Something like the following is the desired effect:
private final String license = "0123-4567-8910";
private final int userId = 1337;
To clarify: the above values would be set by passing arguments through the command line (hopefully).
You can use Ant's <replace>
tag for this.
suppose your log4j properties contains placeholder as
log4j.properties
log4j.appender.R.File=LOGS_DIR_PATH/JBulletinBoard.log
Then you can do like
<replace file="log4j.properties" token="LOGS_DIR_PATH" value="D:/logs"/>
I am not exactly sure what you are trying to do and I will avoid the debate about Maven vs Ant as life is to short..
Its very possible to externalize a properties file and have a common ant file.
Tell ant about your property file
<property file="licence.properties" />
and you can refer to your properties in that file like
<echo message="Registered licence = ${build.licence}" />
精彩评论