Reputation: 487
tar zcvf Test.tar.gz /var/trac/test /var/svn/test
So far I have:
<target name="archive" depends="init">
<tar compression="gzip" destfile="test.tar.gz">
<tarfileset dir="/">
<include name="/var/trac/test" />
</tarfileset>
<tarfileset dir="/">
<include name="/var/trac/svn" />
</tarfileset>
</tar>
</target>
With debugging on, it always says "No sources found" so I'm a bit perplexed on what to do next.
Upvotes: 2
Views: 8929
Reputation: 100736
There are several things here that can go wrong:
Are /var/trac/test
and /var/svn/test
files or directories? Real tar
would work fine with both; your task - the way it's written right now - would only work with files but not folders.
Do you (or, rather, does Ant process) have adequate permissions?
<include>
elements contain patterns, which are generally relative to base dir. You're specifying them as absolute.
I would rewrite the above as:
<target name="archive" depends="init">
<tar compression="gzip" destfile="test.tar.gz">
<tarfileset dir="/var/trac" prefix="/var/trac">
<include name="test/**" />
<include name="svn/**" />
</tarfileset>
</tar>
</target>
prefix
allows you to explicitly specify the path with which files in Tar archive should begin.
/**
within <include>
tells Ant to take all the files from that folder and all its subfolders. If /var/trac/test
and /var/svn/test
are indeed files and not folders then you can omit that.
Upvotes: 5