Apache

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • particular fileset question

    7 answers - 1356 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    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 (AT) ant (DOT) apache.org
    For additional commands, e-mail: user-help (AT) ant (DOT) apache.org
  • No.1 | | 418 bytes | |

    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 (AT) ant (DOT) apache.org
    For additional commands, e-mail: user-help (AT) ant (DOT) apache.org
  • No.2 | | 2045 bytes | |

    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 (AT) ant (DOT) apache.org
    >For additional commands, e-mail: user-help (AT) ant (DOT) apache.org
    >
    >
  • No.3 | | 315 bytes | |

    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 (AT) ant (DOT) apache.org
    For additional commands, e-mail: user-help (AT) ant (DOT) apache.org
  • No.4 | | 1239 bytes | |

    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 (AT) ant (DOT) apache.org
    For additional commands, e-mail: user-help (AT) ant (DOT) 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 (AT) icsaward (DOT) com
    ccraig (AT) gbg (DOT) com

    To unsubscribe, e-mail: user-unsubscribe (AT) ant (DOT) apache.org
    For additional commands, e-mail: user-help (AT) ant (DOT) apache.org
  • No.5 | | 441 bytes | |

    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 (AT) ant (DOT) apache.org
    For additional commands, e-mail: user-help (AT) ant (DOT) apache.org
  • No.6 | | 2625 bytes | |

    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 (AT) ant (DOT) apache.org
    For additional commands, e-mail: user-help (AT) ant (DOT) 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 (AT) icsaward (DOT) com
    ccraig (AT) gbg (DOT) com

    To unsubscribe, e-mail: user-unsubscribe (AT) ant (DOT) apache.org
    For additional commands, e-mail: user-help (AT) ant (DOT) apache.org
  • No.7 | | 1322 bytes | |

    Wed, 18 Jan 2006, Markus Innerebner
    <markus.innerebner (AT) wuerth-phoenix (DOT) comwrote:

    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 (AT) ant (DOT) apache.org
    For additional commands, e-mail: user-help (AT) ant (DOT) apache.org

Re: particular fileset question


max 4000 letters.
Your nickname that display:
In order to stop the spam: 3 + 2 =
QUESTION ON "Apache"

EMSDN.COM