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 addi开发者_开发百科ng the target file and it's contents to the tar file dispite specifying the it to be excluded via excludes=dir
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>
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\**
Through trial and error I found this to be a solution:
**/target/**
精彩评论