You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Thomas Lionel SMETS <ts...@netscape.net> on 2003/12/05 14:49:27 UTC

FileSet within FileSet

In my build I have Patternsets, from which I build Filesets, like here below :
    <!-- Libraries -->
    <patternset id="pattern.lib.files">
        <include name="*.jar" />
        <include name="*.zip" />
    </patternset>
    
    <!-- Byte code files -->
    <patternset id="pattern.class.files">
        <include name="**/*.class" />
    </patternset>

>From which I created FileSets :
    <!-- The list of compiled files (containing the Byte code). -->
    <fileset id="compiled.files"
         dir="${build.dir}">
        <patternset refid="pattern.class.files" />
    </fileset>

    <!-- The list with all the jars /  libraries -->
    <fileset id="lib.files"
         dir="${lib.dir}" >
        <patternset refid="pattern.lib.files" />     
    </fileset>          


Now for creating my jar, the would like to include both file sets defined here above, to have something like :
    <!-- The files to be jarred -->
    <fileset id="jarred.files">
        <include refid="compiled.files" />
        <include refid="lib.files" />   
        <include refid="java.files" unless="${prod.flag}" />    
    </fileset>

But as it turn out the run of that gives :
file:C:/Data/idxxxxxx_PRJ_JAVA_MAIN/PRJ_JAVA/PRJCommon/script/build.xml:70: Class org.apache.tools.ant.types.PatternSet$
NameEntry doesn't support the "refid" attribute.
        at org.apache.tools.ant.IntrospectionHelper.setAttribute(IntrospectionHelper.java:422)
        at org.apache.tools.ant.ProjectHelper.configure(ProjectHelper.java:306)
        at org.apache.tools.ant.helper.ProjectHelperImpl$NestedElementHandler.init(ProjectHelperImpl.java:970)
        at org.apache.tools.ant.helper.ProjectHelperImpl$DataTypeHandler.startElement(ProjectHelperImpl.java:1137)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
        at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.tools.ant.helper.ProjectHelperImpl.parse(ProjectHelperImpl.java:155)
        at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:117)
        at org.apache.tools.ant.Main.runBuild(Main.java:596)
        at org.apache.tools.ant.Main.start(Main.java:196)
        at org.apache.tools.ant.Main.main(Main.java:235)

Would somebody have an idea to do the same in a configurable manner ?

Tia,

\T,



-- 
 
Thomas SMETS 
rue J. Wytsmanstraat 62
1050 Brussels


__________________________________________________________________
McAfee VirusScan Online from the Netscape Network.
Comprehensive protection for your entire computer. Get your free trial today!
http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397

Get AOL Instant Messenger 5.1 free of charge.  Download Now!
http://aim.aol.com/aimnew/Aim/register.adp?promo=380455

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


Re: FileSet within FileSet

Posted by Stefan Bodewig <bo...@apache.org>.
On Fri, 05 Dec 2003, Thomas Lionel SMETS <ts...@netscape.net> wrote:

>     <fileset id="compiled.files"
>          dir="${build.dir}">
>         <patternset refid="pattern.class.files" />
>     </fileset>
> 
>     <!-- The list with all the jars /  libraries -->
>     <fileset id="lib.files"
>          dir="${lib.dir}" >
>         <patternset refid="pattern.lib.files" />     
>     </fileset>          
>
> Now for creating my jar, the would like to include both file sets
> defined here above, to have something like : 
>
>    <!-- The files to be jarred -->
>    <fileset id="jarred.files">
>        <include refid="compiled.files" />
>        <include refid="lib.files" />   
>        <include refid="java.files" unless="${prod.flag}" />    
>    </fileset>

which doesn't work as you can't nest filesets into filesets - as
filesets are rooted in a common dir by (Ant's) definition.

You could simply use

<jar ...>
  <fileset refid="compiled.files" />
  <fileset refid="lib.files" />   
  <fileset refid="java.files" unless="${prod.flag}" />    
</jar>

but I assume you want to pass the collection of filesets around (or is
there any other reason you don't want to place them under <jar>?).
What are the "other things" you intended to do with your jarred.files
fileset?

Stefan

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