You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Markus Innerebner <ma...@wuerth-phoenix.com> on 2006/01/18 14:32:57 UTC

particular fileset question

I want to have in my fileset only some jar files located in a particular
folder. In my example the set should contain only that jar files, which
are in folderA and folderB

this is the directory stucture:
${lib.dir} ----- folderA
	    I--- folderB
	    I--- folderC	
		

This example does not work:

<available file="${lib.dir}/folderA" type="dir"
property="is.folderA.present"/>
<available file="${lib.dir}/folderB" type="dir"
property="is.folderB.present"/>

<fileset dir="${lib.dir}">
	<include name="**/folderA/*.jar" if="is.folderA.present"/>
	<exclude name="**/folderB/*.jar" if="is.folderB.present"/>
</fileset>

it work only if I explicitly declare the folder:
i.e.:
<fileset dir="${lib.dir}/folderA">
	<include name="**/*.jar"/>
</fileset>

<fileset dir="${lib.dir}/folderB">
	<include name="**/*.jar"/>
</fileset>

Is there a way to do it like in the first example. That's why I want to
use the first example is, that in the include target I can have some
checks if the directory exists or not.

thanks for any suggestion

markus 


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


Re: particular fileset question

Posted by Markus Innerebner <ma...@wuerth-phoenix.com>.
In my second mail I wrote the right example.
My intention is to include all jars in folderA and folderB, ecluding
jars in folderC.

regards Markus

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


Re: particular fileset question

Posted by Mark Russell <ma...@instantiations.com>.
I think you need to make the second one an include instead of an 
exclude.  you state in your question that you want to include both 
folderA and folderB but you exclude folderB Then it looks like it should 
work to me.  Like this

<fileset dir="${lib.dir}">
	<include name="**/folderA/*.jar" if="is.folderA.present"/>
	<include name="**/folderB/*.jar" if="is.folderB.present"/>
</fileset>



Markus Innerebner wrote:

>I want to have in my fileset only some jar files located in a particular
>folder. In my example the set should contain only that jar files, which
>are in folderA and folderB
>
>this is the directory stucture:
>${lib.dir} ----- folderA
>	    I--- folderB
>	    I--- folderC	
>		
>
>This example does not work:
>
><available file="${lib.dir}/folderA" type="dir"
>property="is.folderA.present"/>
><available file="${lib.dir}/folderB" type="dir"
>property="is.folderB.present"/>
>
><fileset dir="${lib.dir}">
>	<include name="**/folderA/*.jar" if="is.folderA.present"/>
>	<exclude name="**/folderB/*.jar" if="is.folderB.present"/>
></fileset>
>
>it work only if I explicitly declare the folder:
>i.e.:
><fileset dir="${lib.dir}/folderA">
>	<include name="**/*.jar"/>
></fileset>
>
><fileset dir="${lib.dir}/folderB">
>	<include name="**/*.jar"/>
></fileset>
>
>Is there a way to do it like in the first example. That's why I want to
>use the first example is, that in the include target I can have some
>checks if the directory exists or not.
>
>thanks for any suggestion
>
>markus 
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>
>  
>


-- 
Mark Russell
Instantiations, Inc.
724-368-3331 (land line)
http://www.instantiations.com 



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


Re: particular fileset question

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 18 Jan 2006, Markus Innerebner
<ma...@wuerth-phoenix.com> wrote:

> I want to have in my fileset only some jar files located in a
> particular folder. In my example the set should contain only that
> jar files, which are in folderA and folderB
> 
> this is the directory stucture:
> ${lib.dir} ----- folderA
> 	    I--- folderB
> 	    I--- folderC	
> 		
> 
> This example does not work:
> 
> <available file="${lib.dir}/folderA" type="dir"
> property="is.folderA.present"/>
> <available file="${lib.dir}/folderB" type="dir"
> property="is.folderB.present"/>

Not necessary, if the dirs are not there it won't hurt to mention them
in the patterns at all.

> <fileset dir="${lib.dir}">
> 	<include name="**/folderA/*.jar" if="is.folderA.present"/>
> 	<exclude name="**/folderB/*.jar" if="is.folderB.present"/>
> </fileset>

If you said "and" folderB you don't want to exclude that, do you?

It probably should be

<fileset dir="${lib.dir}">
  <include name="folderA/*.jar"/>
  <include name="folderB/*.jar"/>
</fileset>

Stefan

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


Re: particular fileset question

Posted by Clifton Craig <cc...@gbg.com>.
On Wednesday 18 January 2006 9:16 am, Markus Innerebner wrote:
> Hi
>
> > <fileset dir="${lib.dir}">
> >         <include name="folderA/*.jar" if="is.folderA.present"/>
> >         <include name="folderB/*.jar" if="is.folderB.present"/>
> > </fileset>
>
> also your approach does not work in my example.
> Did you try it out?
>
> markus
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org

Yes, I tried it out. I added this to an arbitrary build in my project:
    <target name="example" depends="init" >
        <mkdir dir="${build.dir}/ex/lib1"/>
        <copy todir="${build.dir}/ex/lib1">
            <fileset dir="${build.lib.dir}"/>
        </copy>
        <mkdir dir="${build.dir}/ex/lib2"/>
        <copy todir="${build.dir}/ex/lib2">
            <fileset dir="${build.lib.dir}"/>
        </copy>
        <available file="${build.dir}/ex/lib1" type="dir" 
property="lib1.present"/>
        <available file="${build.dir}/ex/lib2" type="dir" 
property="lib2.present"/>
        <fileset dir="${build.dir}/ex" id="exfs">
            <include name="lib1/*.jar" if="lib1.present"/>
            <include name="lib2/*.jar" if="lib2.present"/>
        </fileset>
        <property name="fs" refid="exfs"/>
        <echo message="Fileset: ${fs}"/>
    </target>

...and I get this output:

Fileset: 
lib1/avalon-framework.jar;lib1/batik.jar;lib1/commons-logging.jar;lib1/fop.jar;lib1/iceutils.jar;lib1/jaxen.jar;lib1/jdom.jar;lib1/saxpath.jar;lib1/xalan.jar;lib2/avalon-framework.jar;lib2/batik.jar;lib2/commons-logging.jar;lib2/fop.jar;lib2/iceutils.jar;lib2/jaxen.jar;lib2/jdom.jar;lib2/saxpath.jar;lib2/xalan.jar

I comment out these lines:
<!--
        <mkdir dir="${build.dir}/ex/lib2"/>
        <copy todir="${build.dir}/ex/lib2">
            <fileset dir="${build.lib.dir}"/>
        </copy>
-->

and delete the ex folder under my build.dir and I get this output:
Fileset: 
lib1/avalon-framework.jar;lib1/batik.jar;lib1/commons-logging.jar;lib1/fop.jar;lib1/iceutils.jar;lib1/jaxen.jar;lib1/jdom.jar;lib1/saxpath.jar;lib1/xalan.jar

maybe something else is amiss in your code...? Let me read the other responses 
posted here...
--------------------------------------------------- 
Clifton C. Craig, Software Engineer
Intelligent Computer Systems -  A Division of GBG
ccc@icsaward.com
ccraig@gbg.com

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


Re: particular fileset question

Posted by Markus Innerebner <ma...@wuerth-phoenix.com>.
Hi 

> <fileset dir="${lib.dir}">
>         <include name="folderA/*.jar" if="is.folderA.present"/>
>         <include name="folderB/*.jar" if="is.folderB.present"/>
> </fileset>


also your approach does not work in my example.
Did you try it out?

markus

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


Re: particular fileset question

Posted by Clifton Craig <cc...@gbg.com>.
On Wednesday 18 January 2006 8:37 am, Markus Innerebner wrote:
> I wrote wrong something:
>
> this is the right one
> <fileset dir="${lib.dir}">
>         <include name="**/folderA/*.jar" if="is.folderA.present"/>
>         <include name="**/folderB/*.jar" if="is.folderB.present"/>
> </fileset>
>
> Markus
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org

The approach seems to work for me. Just changed this:
> <fileset dir="${lib.dir}">
>         <include name="**/folderA/*.jar" if="is.folderA.present"/>
>         <include name="**/folderB/*.jar" if="is.folderB.present"/>
> </fileset>

to this:
<fileset dir="${lib.dir}">
        <include name="folderA/*.jar" if="is.folderA.present"/>
        <include name="folderB/*.jar" if="is.folderB.present"/>
</fileset>

--------------------------------------------------- 
Clifton C. Craig, Software Engineer
Intelligent Computer Systems -  A Division of GBG
ccc@icsaward.com
ccraig@gbg.com

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


Re: particular fileset question

Posted by Markus Innerebner <ma...@wuerth-phoenix.com>.
I wrote wrong something:

this is the right one
<fileset dir="${lib.dir}">
        <include name="**/folderA/*.jar" if="is.folderA.present"/>
        <include name="**/folderB/*.jar" if="is.folderB.present"/>
</fileset>

Markus

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