Will
Will

Reputation: 8631

Ant not excluding files from build

I'm currently building a tar:

<property name="dcc-shell.dir" value="."/>
<property name="dcc-mdp.dir" value="${dcc-shell.dir}/eq-mo-drop-copy-converter-mdp"/>
<property name="mdp-code.dir" value="${dcc-mdp.dir}/*"/>
<property name="mdp-exclude.dir" value="${dcc-mdp.dir}/target"/>
<property name="dcc-srv.dir" value="${dcc-shell.dir}/eq-mo-drop-copy-converter-server"/>
<property name="srv-code.dir" value="${dcc-srv.dir}/src/main/*"/>
<property name="dcc-trans.dir" value="${dcc-shell.dir}/eq-mo-drop-copy-converter-transformer"/>
<property name="trans-code.dir" value="${dcc-trans.dir}/src/main/*"/>

<target name="create MDP.Tar">
    <tar destfile="${dcc-shell.dir}/mdp.tar"
        excludes="${mdp-exclude.dir}"
        basedir="${dcc-mdp.dir}"
    />
</target>

however it continuly keeps adding the target file and it's contents to the tar file dispite specifying the it to be excluded via excludes=dir

Upvotes: 1

Views: 2331

Answers (3)

Will
Will

Reputation: 8631

Through trial and error I found this to be a solution: **/target/**

Upvotes: 0

Nix
Nix

Reputation: 58522

Its because your relative paths are off, your script is basically doing this:

Include all files from the directory:

./eq-mo-drop-copy-converter-mdp

but dont include this one:

./eq-mo-drop-copy-converter-mdp\target

Which really reads eq-mo-drop-copy-converter-mdp/eq-mo-drop-copy-converter-mdp\target which doesn't exist.

You need to specify exclude .\target\**

Upvotes: 0

David W.
David W.

Reputation: 107040

You need the "**" to exclude the directory and everything in it. These excludes are file based and not directory based.

<target name="create MDP.Tar">
    <tar destfile="${dcc-shell.dir}/mdp.tar"
        excludes="${mdp-exclude.dir}/**"
        basedir="${dcc-mdp.dir}"
    />
</target>

Upvotes: 1

Related Questions