ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Neal McLoughlin" <>
Subject RE: jar update
Date Tue, 18 Sep 2001 20:01:21 GMT
You need to set the includes attribute for an in-line fileset (not
includesfile).  The includesfile attribute expects a file that contains
the name of files to include.

You'll probably want something like this :

  <target name="buildJar" depends="compile">
    <echo message="------------------" />
    <echo message="Building jar file in progress" />
    <jar jarfile="${Build_Location}/CreditCard.jar"
includes="com/westgroup/esolutions/TransactionLog.class" update="true"/>

-----Original Message-----
From: Tan, Ming []
Sent: Tuesday, September 18, 2001 12:00 PM
To: ''
Subject: jar update

Hi, all:

I have ANT 1.4, which has the "update" attribute for the jar task.
it still doesn't work as I expected. After I ran it, it only updated the
manifest file. Please help.

Here's my code:

<!-- ======================================================= -->
<!-- 5. Create jar file for all classes                      -->
<!-- ======================================================= -->
  <target name="buildJar" depends="compile">
    <echo message="------------------" />
    <echo message="Building jar file in progress" />
    <jar jarfile="${Build_Location}/CreditCard.jar" 


-----Original Message-----
From: Pugh, Eric []
Sent: Tuesday, September 18, 2001 12:55 PM
To: ''
Subject: RE: Passing in parameters (IF statement question)

I think I must be doing things the hard way!   The reason I want to be
to hand in parameters like ps and pl is as a shortcut to remembering
the server path is for ps...  For instance, is ps  \\production\stage,
has it been changed to \\production\newshare\stage.  Also, to just
the typing required.  We have four enviroments, with two shares (stage
live) on each.   

I also think I am pushing ant in a non normal direction.  Less as a
tool, but more as a tool to deploy images and .asp files to our various
environments.  I am using ant to encapsulate the logic to move files, as
well as tie it into the BeyondCompare diff program.  

I think I solved my problem based on some of the feed back given by
on the list.  I have definied in my build.xml the properties: 
	ps (production stage) 
	pl (production live)
	dl (development live)
	ds (development stage)  

I created a task called PropertyFromProperty.  

So when I call ant from a batch file called bc.cmd:
<begin bc.cmd>
@echo off

call ant compare -Denvironment1=%1 -Denvironment2=%2
<end bc.cmd>
I pass in the two enviroment "shortcuts" i want.  So "bc.cmd pl dl"
the ant call:
 ant compare -Denvironment1=pl -Denvironment2=dl.

Then in my target compare I call the task PropertyFromProperty that
a property based on the name of another property with the value of that
other property:
<begin build.xml>
  <target name="compare">
      <propertyfromproperty name="bc.environment1"
      <propertyfromproperty name="bc.environment2"
      <exec executable="${bc.executable}" newenvironment="true"
        <arg line="${bc.environment1}"/>
        <arg line="${bc.environment2}"/>
        <arg line="/expandall"/>
        <arg line="/display=mismatches"/>
        <arg line="/rules=Quick"/>   
        <arg line="/configpath=c:\istore\build\"/>         

<end build.xml>




// syntax: <propertyupdater name="result" property="env"/>

public class PropertyFromProperty extends Task {
  private String name;
  private String property;

  // The method executing the task
  public void execute() throws BuildException {

    if (name == null || property == null) {
      throw new BuildException("You must specify name and property.");

    if (project.getProperty(property) == null) {
      throw new BuildException("The property " + property + " doesn't

    if (project.getProperty(project.getProperty(property)) == null) {
      throw new BuildException("The property " +
project.getProperty(property) + " doesn't exist.");

    System.out.println("project.getProperty(property):" +


  // The setter for the "name" attribute
    public void setName(String name) { = name;

  // The setter for the "property" attribute
    public void setProperty(String property) { = property;

I now am thinking that I might have accomplished this same task using
condition and equals task?  At any rate, if anyone wants this code they
free to snag it!  It does let me, with a batch file, be able to pass
parameters into ant.


-----Original Message-----
From: Diane Holt []
Sent: Tuesday, September 18, 2001 1:01 PM
Subject: RE: Passing in parameters (IF statement question)


It's a little hard to advise you, since you haven't given much detail on
what your build-file does (eg., what effect setting your "environmentN"
properties has on the build). I'm not sure why you need the batch-file
what your in-house task does, but if you want to keep going with what
have so far, the question is: Why are you going through ${environment1}
your batch-file instead of just transforming the command-line "ps" to
"\\production\stage" to begin with? (My suspicion is you might be going
long way around to do something that could be done more easily.) In any
case, if you're using Ant 1.4, you can use the <condition> task to set
value of your "ps", "pl", etc. properties by using the <equal> tag to
what ${environment1} is set to (although, again, I suspect you may be
going down a more convoluted path than you need to).


--- "Pugh, Eric" <> wrote:
> I guess after reading and playing with some of the changes suggested,
> am getting closer to defining what i want!
> I took Erik's suggestion, and created a batch file wrapper.  I have a
> task called compare that invokes Beyond Compare to do a comparison of
> some file directories.  My batch file takes in a "short name" for each
> enviroment. In other workds pl means production live.  ps means
> production stage.  I have properties definied in my build.xml:
> 	${ps}  = \\production\stage
> 	${pl}  = \\production\live
> These two parameters are passed into my ant compare task via the batch
> file. Excellent so far, I can call bc.cmd ps pl and ant will get
> with two paramters set:  ant compare -Denviroment1=ps
> Then in my ant task that exec's the BeyondCompare.exe I pass the two
> short names: ${enviroment1}.  However, what I am now discovering is
> I am executing this command:  
> 	c:\beyondcompare.exe pl ps.  
> 	c:\beyondcompare.exe \\production\live  \\production\stage
> What I really want is to have some sort of IF statement that says
> 	IF ${enviroment1} = "ps" then
> 		${enviroment1} = ${ps}
> 	END if
> This kind of scripting I know has been banned from ANT2, under the
> theory that there are plenty of scripting tools.  So what have people
> done to make this kind of functionality work?  Use the BSF stuff?
> Eric


Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information

View raw message