You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Nick Bauman <ni...@cortexity.com> on 2002/01/22 17:29:40 UTC
properties files aren't getting included
Am I just being stupid? I have some properties files in my project that
ant seems to ignore when making a jar. I looked at the documentation and I
searched the archives and couldn't find anything relevant on this subject.
Is there some special parameter I need to add to the jar making task(s)
that will include properties files in the classpath? Thanks for any
insights.
--
Nick Bauman
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: properties files aren't getting included
Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 22 Jan 2002, Nick Bauman <ni...@cortexity.com> wrote:
> I have some properties files in my project that ant seems to ignore
> when making a jar. I looked at the documentation and I searched the
> archives and couldn't find anything relevant on this subject.
How does the task look like?
Could there be an exclude pattern that matches the file or could it be
that the file doesn't match any include patterns (pattern matching in
Ant is case-sensitive by default).
Stefan
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: properties files aren't getting included
Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Nick Bauman" <ni...@cortexity.com>
To: <an...@jakarta.apache.org>
Sent: Tuesday, January 22, 2002 09:50
Subject: Re: properties files aren't getting included
> > I would add a copy task in the compile target which copies
> > **/*properties from src to build
>
> Yes, I did that and that has solved the problem. Thanks. I added the
> entity to the "compile" target in my build.xml and it's now working fine.
> In particular, I added:
>
> <copy todir="${build}/org/foo/messages">
> <fileset dir="${src}/org/foo/messages">
> <patternset id="props" >
> <include name="**/*.properties"/>
> </patternset>
> </fileset>
> </copy>
>
> I guess I was making a stupid assumption that compiling would
> automatically do this for me.
It did a long time ago, but now only java files get pulled over. The reason
was that too much other cruft kept getting into the JAR file; random text
files, the odd bit of binary, etc. Now you have to be explicit about
bringing stuff in.
NB, you could do a tree copy in a way which is easier to re-use in followup
builds:
<copy todir="${build}">
<fileset dir="${src}" includes="**/*.properties,**/*.xml,**/*.dtd"/>
</copy>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: properties files aren't getting included
Posted by Diane Holt <ho...@yahoo.com>.
--- Nick Bauman <ni...@cortexity.com> wrote:
> Yes, I did that and that has solved the problem. Thanks. I added the
> entity to the "compile" target in my build.xml and it's now working
> fine.
Not that doing it your way is wrong, but you might want to consider making
the copy a separate target, for cases where you've only changed the
properties file(s) and want to get it into your build dir, so you don't
have to wade through the compile part just to get to the copy. You could
have your jar'ing target depend on your compile and copy target, for when
you want to build the jar, and keep the compile and copy targets
independent, so you can run them individually when you know that's all you
want to do.
Diane
=====
(holtdl@yahoo.com)
__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: properties files aren't getting included
Posted by Nick Bauman <ni...@cortexity.com>.
Steve said:
> ----- Original Message -----
> From: "Nick Bauman" <ni...@cortexity.com>
> To: <an...@jakarta.apache.org>
> Sent: Tuesday, January 22, 2002 09:06
> Subject: Re: properties files aren't getting included
>
>
>> Thanks for your help:
>>
>> > ----- Original Message -----
>> > From: "Nick Bauman" <ni...@cortexity.com>
>> > To: <an...@jakarta.apache.org>
>> > Sent: Tuesday, January 22, 2002 8:29 AM
>> > Subject: properties files aren't getting included
>> >
>> >
>> >> Am I just being stupid? I have some properties files in my project
>> >> that ant seems to ignore when making a jar. I looked at the
>> >> documentation and I searched the archives and couldn't find
>> >> anything relevant on this subject.
>> >
>> > I assume you have the properties files next to the java source
>> > right?
>>
>> Yes, it's in my src/ in a subpackage, right alongside my code.
>>
>> > And then you jar up the compiled classes in the build directory,
>> > right?
>>
>> Yup.
>>
>> > If these two guesses are correct, how are you getting the properties
>> > from the source dir to the build dir?
>>
>> I'm not. That's the problem, then. I need some kind of parameter to
>> the "dist" task to keep the properties with the compiled classes.
>> > -steve
>
>
> I would add a copy task in the compile target which copies
> **/*properties from src to build
Yes, I did that and that has solved the problem. Thanks. I added the
entity to the "compile" target in my build.xml and it's now working fine.
In particular, I added:
<copy todir="${build}/org/foo/messages">
<fileset dir="${src}/org/foo/messages">
<patternset id="props" >
<include name="**/*.properties"/>
</patternset>
</fileset>
</copy>
I guess I was making a stupid assumption that compiling would
automatically do this for me.
--
Nick Bauman
Java Programmer.
Available Cheap.
Minneapolis area.
Will Commute.
Resume: http://www.cortexity.com/resume.html
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: properties files aren't getting included
Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Nick Bauman" <ni...@cortexity.com>
To: <an...@jakarta.apache.org>
Sent: Tuesday, January 22, 2002 09:06
Subject: Re: properties files aren't getting included
> Thanks for your help:
>
> > ----- Original Message -----
> > From: "Nick Bauman" <ni...@cortexity.com>
> > To: <an...@jakarta.apache.org>
> > Sent: Tuesday, January 22, 2002 8:29 AM
> > Subject: properties files aren't getting included
> >
> >
> >> Am I just being stupid? I have some properties files in my project
> >> that ant seems to ignore when making a jar. I looked at the
> >> documentation and I searched the archives and couldn't find anything
> >> relevant on this subject.
> >
> > I assume you have the properties files next to the java source right?
>
> Yes, it's in my src/ in a subpackage, right alongside my code.
>
> > And then you jar up the compiled classes in the build directory, right?
>
> Yup.
>
> > If these two guesses are correct, how are you getting the properties
> > from the source dir to the build dir?
>
> I'm not. That's the problem, then. I need some kind of parameter to
> the "dist" task to keep the properties with the compiled classes.
> > -steve
I would add a copy task in the compile target which copies **/*properties
from src to build
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: properties files aren't getting included
Posted by Nick Bauman <ni...@cortexity.com>.
Thanks for your help:
> ----- Original Message -----
> From: "Nick Bauman" <ni...@cortexity.com>
> To: <an...@jakarta.apache.org>
> Sent: Tuesday, January 22, 2002 8:29 AM
> Subject: properties files aren't getting included
>
>
>> Am I just being stupid? I have some properties files in my project
>> that ant seems to ignore when making a jar. I looked at the
>> documentation and I searched the archives and couldn't find anything
>> relevant on this subject.
>
> I assume you have the properties files next to the java source right?
Yes, it's in my src/ in a subpackage, right alongside my code.
> And then you jar up the compiled classes in the build directory, right?
Yup.
> If these two guesses are correct, how are you getting the properties
> from the source dir to the build dir?
I'm not. That's the problem, then. I need some kind of parameter to
the "dist" task to keep the properties with the compiled classes.
> -steve
here's my ant build.xml:
<project name="foo" default="dist" basedir=".">
<!-- set global properties for this build -->
<property name="src" value="src" />
<property name="build" value="classes"/>
<property name="dist" value="lib"/>
<property name="javadoc" value="${dist}/doc"/>
<property name="rel" value="/usr/local/servlet/lib"/>
<property name="jarfile" value="foo.jar"/>
<property name="project" value="foo"/>
<property name="nightly" value="/usr/local/apache/dr/org/nightly"/>
<property name="build.compiler" value = "jikes"/>
<property name="build.compiler.emacs" value = "true"/>
<target name="default">
<tstamp/>
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="default">
<!-- compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}" debug="on" deprecation="on">
<classpath>
<pathelement path="${classpath}"/>
<fileset dir="/usr/local/jdk13/jre/lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="lib/external-libs">
<include name="**/*.jar"/>
</fileset>
<pathelement location="classes"/>
</classpath>
</javac>
</target>
<target name="dist" depends="compile">
<jar jarfile="${dist}/${jarfile}" basedir="${build}"/>
</target>
<target name="nightly" depends="clean,compile,javadoc">
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
<jar jarfile="${nightly}/${project}-${DSTAMP}.jar" basedir="${build}"/>
</target>
<target name="release" depends="compile">
<jar jarfile="${rel}/${jarfile}" basedir="${build}"/>
</target>
<target name="clean">
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}/org"/>
<delete dir="${javadoc}"/>
<delete dir="bak"/>
<delete file="${dist}/${jarfile}"/>
</target>
<target name="javadoc">
<tstamp/>
<mkdir dir="${javadoc}"/>
<javadoc packagenames="org.*, doc.*"
sourcepath="src"
classpath="${classes}:${classpath}"
destdir="${javadoc}"
author="true"
Private="true"
version="true"
use="true"
windowtitle="Foo API"
doctitle="Foo Javadoc">
</javadoc>
</target>
</project>
--
Nick Bauman
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: properties files aren't getting included
Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Nick Bauman" <ni...@cortexity.com>
To: <an...@jakarta.apache.org>
Sent: Tuesday, January 22, 2002 8:29 AM
Subject: properties files aren't getting included
> Am I just being stupid? I have some properties files in my project that
> ant seems to ignore when making a jar. I looked at the documentation and I
> searched the archives and couldn't find anything relevant on this subject.
I assume you have the properties files next to the java source right?
And then you jar up the compiled classes in the build directory, right?
If these two guesses are correct, how are you getting the properties from
the source dir to the build dir?
-steve
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>