[PLUG] zip inside an antfile ... strange

tkubaska at charter.net tkubaska at charter.net
Wed Jun 6 03:55:19 UTC 2007


I am very confused. I'm looking at a zip inside an antfile that doesn't work. I have extracted asimple example that illustrates the issue I am having. Can someone take a
look at what follows? ... it's not long to read and I've tried all my tricks ... it seems very strange to me.

1.
Note that there are jar files present in the following directory
hierarchy.
ted at halibut:/opt/build001.ecf/ecf.build/tmp$ ls -R
.:
customTargets.xml  eclipse
./eclipse:
plugins
./eclipse/plugins:
org.apache.commons.codec_1.2.0.jar
org.apache.commons.httpclient_3.0.1.v200703281019.jar
org.apache.commons.logging_1.0.4.v200701082340.jar

2.
Try this simple ant file as follows: (Note that I am running in tmp and
eclipse/plugins are local to me.)
ted at halibut:/opt/build001.ecf/ecf.build/tmp$ cat customTargets.xml
<project default="main">
 <target name="main">
    <exec executable="zip" >
       <arg line="-r foo.zip eclipse/plugins/*.jar" />
    </exec>
 </target>
</project>

3.
It doesn't work. (BTW, docs tell me it should.) Not matched? -- the files
are really there as shown above.
ted at halibut:/opt/build001.ecf/ecf.build/tmp$ ant -f customTargets.xml
Buildfile: customTargets.xml

main:
     [exec]     zip warning: name not matched: eclipse/plugins/*.jar
     [exec]
     [exec] zip error: Nothing to do! (try: zip -r foo.zip . -i
eclipse/plugins/*.jar)
     [exec] Result: 12

BUILD SUCCESSFUL
Total time: 0 seconds
ted at halibut:/opt/build001.ecf/ecf.build/tmp$

4.
Do it from the command line (not thru an antfile and it works).
ted at halibut:/opt/build001.ecf/ecf.build/tmp$ zip -r foo.zip
eclipse/plugins/*.jar
  adding: eclipse/plugins/org.apache.commons.codec_1.2.0.jar (deflated
13%)
  adding:
eclipse/plugins/org.apache.commons.httpclient_3.0.1.v200703281019.jar
(deflated 9%)
  adding:
eclipse/plugins/org.apache.commons.logging_1.0.4.v200701082340.jar
(deflated 10%)
ted at halibut:/opt/build001.ecf/ecf.build/tmp$

5.
The antfile will work if I don't use the *. That is, if I explicitly
type out the jar file name without a wildcard. I have tried various
schemes for escaping the * ... such as \*, **/*, **/\*, etc.

I've put in a bunch of time on this ... I'm stuck.
 -ted







More information about the PLUG mailing list