You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Holger Rauch <Ho...@heitec.de> on 2002/04/16 09:17:38 UTC

Using in

Hi!

I'm trying to use the <fileset> element in a <jar> element in order to
reference things that I declared globally in my build.xml file in a
<fileset> element. To be more precise:

<patternset id="all-icons">
    <include name="${empic.src}/**/*.jpg"/>
    <include name="${empic.src}/**/images/*.gif"/>
  </patternset>

  <patternset id="all-i18n">
    <include name="${empic.src}/**/*.properties"/>
    <include name="${empic.src}/**/combo_values.txt"/>
  </patternset>

  <fileset id="all-resources" dir="${empic.src}">
    <patternset refid="all-icons"></patternset>
    <patternset refid="all-i18n"></patternset>
  </fileset>

(These are all defined globally). In order to create the JAR file I use:

<target name="allapps">
    <copy todir="${empic.bin}">
      <fileset refid="all-resources"></fileset>
    </copy>
    <jar jarfile="${allapps.path}/allapps.jar" basedir="${empic.bin}">
      <include name="**/*.class"/>
      <fileset refid="all-resources"></fileset>
      <exclude name="global.ex"/>
    </jar>
</target>

The <fileset refid=...> doesn't work as I would expect it - including the
stuff referenced by the refid attribute. What am I doing wrong here?

Any help will be greatly appreciated! Thanks in advance!

Greetings,

	Holger



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Using in

Posted by Adam Murdoch <ad...@apache.org>.
On Tue, 16 Apr 2002 17:17, Holger Rauch wrote:
> Hi!
>
> I'm trying to use the <fileset> element in a <jar> element in order to
> reference things that I declared globally in my build.xml file in a
> <fileset> element. To be more precise:
>
> <patternset id="all-icons">
>     <include name="${empic.src}/**/*.jpg"/>
>     <include name="${empic.src}/**/images/*.gif"/>
>   </patternset>
>
>   <patternset id="all-i18n">
>     <include name="${empic.src}/**/*.properties"/>
>     <include name="${empic.src}/**/combo_values.txt"/>
>   </patternset>

Get rid of the '${empic.src}' from these patterns.  The patterns are matched 
against file names that are relative to the root dir of the fileset, i.e. 
they're relative to ${empic.src}.

>   <fileset id="all-resources" dir="${empic.src}">
>     <patternset refid="all-icons"></patternset>
>     <patternset refid="all-i18n"></patternset>
>   </fileset>
>
> (These are all defined globally). In order to create the JAR file I use:
>
> <target name="allapps">
>     <copy todir="${empic.bin}">
>       <fileset refid="all-resources"></fileset>
>     </copy>
>     <jar jarfile="${allapps.path}/allapps.jar" basedir="${empic.bin}">
>       <include name="**/*.class"/>
>       <fileset refid="all-resources"></fileset>
>       <exclude name="global.ex"/>
>     </jar>
> </target>
>

You're including stuff twice here - first it is copied to ${empic.bin}, and 
then it is jarred up from there, and also from it's original location, thanks 
to the nested <fileset>.

You want to either skip the copy, or get rid of the nested <fileset>.


-- 
Adam

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: jar file locking with ant.

Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 16 Apr 2002, detlef brendle <de...@canoo.com> wrote:

> I checked the cleanup() method of the AntClassLoader and for some
> reason it only frees the zip resource files.

It is not AntClassLoader that is keeping the jars open (most probably
there isn't even an instance of AntClassLoader involved), it is Sun's
javac implementation (and there is nothing Ant can do about it).

Run javac with fork="true" or use jikes to get rid of the problem.

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


jar file locking with ant.

Posted by de...@canoo.com.
good morning ,
I run into a problem when using Ant 1.4.1

Heres my setup:
I have a project with different jar files for compiling my source code against it.
I then call the "build" and "clean" targets to generate all I need (no matter
how much
sense it makes to first build then clean in the same project.)
During the live cycle of on project instance (for both targets) it seems as if
the reffered Jar files
from the 'javac' classpath tag are not beeing closed.
The effect is that the second target 'clean' fails because the project instance
still holds a handle to used jar files.

I checked the cleanup() method of the AntClassLoader and for some reason it only
frees the zip resource files.

>From my point of view I dont see a benefit of holding these handles after using
<javac> until the project has finished.

My questions now are :

a) Is this a known problem to the Ant community and has somebody found a way
around it ?

b) is this a intended behaviour of Ant ? or is it a situation which hasnt been
thought about in the first place.


any help would be appreciated,

regards,
detlef brendle



************* build snipplet **************
<javac
		includeAntRuntime="no"
		extdirs=""
		destdir="${BASE_DIR}/classes"
		>
		<src path="${BASE_DIR}/prod/src" />
		<include name="**/*.java"/>
		<exclude name="**/doc-files/*" />
		<classpath>
			<path refid="computed.path" /> <!-- something like <pathelement
location="servlet.jar" /> <pathelement location="saxp.jar" />
		</classpath>
</javac>

**************clean snipplet ***********

<delete>
	<fileset dir="${BASE_DIR}" excludes="*.java" />
</delete>

***************************************





--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>