ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
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}"/>
    <sequential>
        <tar tarfile="@{tarfile}">
            <tarfileset dir="@{distrib}" prefix="rex">
                <exclude name="@{distrib}/*.cgi"/>
                <exclude name="@{distrib}/*.pl"/>
                <exclude name="@{distjar}"/>
            </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}"/>
    </sequential>
</macrodef> 

<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
        /home/ThomHehl/src/Javacode/rex/distrib 
with patternSet{ 
    includes: []
    excludes: [
        /home/ThomHehl/src/Javacode/rex/distrib/*.cgi,
        /home/ThomHehl/src/Javacode/rex/distrib/*.pl,
        /home/ThomHehl/src/Javacode/rex/distrib/rexml.jar] }
    ...
[tar] rexml.jar added as 
        /home/ThomHehl/src/Javacode/rex/rex.tar
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!


Jan


>-----Urspr├╝ngliche Nachricht-----
>Von: Thom Hehl [mailto:thom@nowhereatall.com] 
>Gesendet: Montag, 8. August 2005 17:48
>An: user@ant.apache.org
>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
>tasks:
>
>    <!-- 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}"/>
>
>Where:
>  ...
>  <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/*.pl,
>/home/ThomHehl/src/Javacode/rex/distrib/rexml.jar] }
>    ...
>      [tar] rexml.jar added as /home/ThomHehl/src/Javacode/rex/rex.tar
>doesn't exist.
>
>Argghhh!!!
>
>Is it just me or is exclude/include unnecessarily touchy?
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For 
>additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message