ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject AW: More exclude problems
Date Tue, 09 Aug 2005 06:23:29 GMT
Just another point - your two tar-commands are nearly the same. You could extract a <macrodef>:

<macrodef name="createtar">
    <attribute name="tarfile"/>
    <attribute name="distjar"/>
    <attribute name="distrib" default="${distrib}"/>
        <tar tarfile="@{tarfile}">
            <tarfileset dir="@{distrib}" prefix="rex">
                <exclude name="@{distrib}/*.cgi"/>
                <exclude name="@{distrib}/*.pl"/>
                <exclude name="@{distjar}"/>
            <tarfileset dir="@{distrib}" mode="755" prefix="rex">
                <include name="@{distrib}/*.cgi"/>
                <include name="@{distrib}/*.pl"/>
        <gzip zipfile="@{tarfile}.gz" src="@{tarfile}"/>
        <delete file="@{tarfile}"/>

<createtar tarfile="${tarfile}"  distjar="${dist-jar}"/>
<createtar tarfile="${tarfile2}" distjar="${dist-jar2}"/>

BTW - your both tarfilesets are using the same prefix. I dont think that they should
(why using two tarfilesets then?).

>From your debug output:
Tar$TarFileSet: Setup scanner in dir
with patternSet{ 
    includes: []
    excludes: [
        /home/ThomHehl/src/Javacode/rex/distrib/rexml.jar] }
[tar] rexml.jar added as 
doesn't exist.

As you can see:
- your exclude is  /home/ThomHehl/src/Javacode/rex/distrib/rexml.jar
- added is         /home/ThomHehl/src/Javacode/rex/rex.tar
And that is ok.

You exclude shouldnt be the absolute path, use only the name as pattern and you should get
what you want.
The reason is that you┬┤re defining the properties via "location" attribute!


>-----Urspr├╝ngliche Nachricht-----
>Von: Thom Hehl [] 
>Gesendet: Montag, 8. August 2005 17:48
>Betreff: More exclude problems
>Thanks to Jan for his excellent and quick answer. I have now 
>built two jar files from the one source.
>Now, to finish my task, I want to create two distributions. 
>The only difference between these two is the two different jar 
>files. Here are my
>    <!-- Build the first tar file -->
>    <tar tarfile="${tarfile}">
>        <tarfileset dir="${distrib}" prefix="rex">
>            <exclude name="${distrib}/*.cgi"/>
>            <exclude name="${distrib}/*.pl"/>
>            <exclude name="${dist-jar2}"/>
>        </tarfileset>
>        <tarfileset dir="${distrib}" mode="755" prefix="rex">
>            <include name="${distrib}/*.cgi"/>
>            <include name="${distrib}/*.pl"/>
>        </tarfileset>
>    </tar>
>    <gzip zipfile="${tarfile}.gz" src="${tarfile}"/>
>    <delete file="${tarfile}"/>
>    <!-- Build the second tar file -->
>    <tar tarfile="${tarfile2}">
>        <tarfileset dir="${distrib}" prefix="rex">
>            <exclude name="${distrib}/*.cgi"/>
>            <exclude name="${distrib}/*.pl"/>
>            <exclude name="${dist-jar}"/>
>        </tarfileset>
>        <tarfileset dir="${distrib}" mode="755" prefix="rex">
>            <include name="${distrib}/*.cgi"/>
>            <include name="${distrib}/*.pl"/>
>        </tarfileset>
>    </tar>
>    <gzip zipfile="${tarfile2}.gz" src="${tarfile2}"/>
>    <delete file="${tarfile2}"/>
>  ...
>  <property name="distrib" location="./distrib"/>
>  <property name="dist-jar" location="${distrib}/rex.jar"/>
>  <property name="dist-jar2" location="${distrib}/rexml.jar"/>
>  ...
>  <property name="tarfile" location="${src}/rex.tar"/>
>  <property name="tarfile2" location="${src}/rexml.tar"/>
>When I run with debug, I get:
>Tar$TarFileSet: Setup scanner in dir
>/home/ThomHehl/src/Javacode/rex/distrib with patternSet{ includes: []
>excludes: [/home/ThomHehl/src/Javacode/rex/distrib/*.cgi,
>/home/ThomHehl/src/Javacode/rex/distrib/rexml.jar] }
>    ...
>      [tar] rexml.jar added as /home/ThomHehl/src/Javacode/rex/rex.tar
>doesn't exist.
>Is it just me or is exclude/include unnecessarily touchy?
>To unsubscribe, e-mail: For 
>additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message