Exclude .git in Ant <tar> task

I use Ant 1.7.1 to offload the contents of a directory containing a .git subdirectory. My current task

<tar
    destfile="sali-src-${version}.tgz"
    basedir="${basedir}"
    compression="gzip"
    excludes=".git, .gitignore, *.ipr, *.iws, *.iml">
</tar>

But the resulting tarball contains a .git subdirectory. Can someone point out how I can prevent it from being turned on?

+5
source share
2 answers

It works:

<?xml version="1.0"?>
<project name="test" default="tar">
        <target name="tar">
            <tar
                destfile="sali-src-${version}.tgz"
                basedir="${basedir}"
                compression="gzip"
                excludes=".git/**, .gitignore/**, **/*.ipr, **/*.iws, **/*.iml">
            </tar>
        </target>
</project>

Your templates were incorrect, for more information about templates read here: http://ant.apache.org/manual/dirtasks.html#patterns

+3
source

Ant default , CVS, Subversion VSS. , . , <defaultexcludes> :

<defaultexcludes add="**/.git/**,**/.gitignore"/>

Git ( <tar> , <javac> , <jar> ).

+3

All Articles