|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
Java source files not part of any packageHello Everyone,
I'm learning to use Ant 1.7.0 as part of Xcode 3.1.2 on Mac OS X 10.6. We have a separate directory called Common/ where we keep common java source files. These files need to get included, not all at the same time though, when compiling our Java applications. What would be the best way to do this? If I add Common/ to srcdir, it compiles everything inside when I only need a one or two. The FAQ mentions that "If you have Java source files that aren't declared to be part of any package, you can still use the <javac> task to compile these files correctly - just set the srcdir and destdir attributes to the actual directory the source files live in and the directory the class files should go into, respectively." But how to do this exactly? Do I need two separate javac tasks like the following? <javac srcdir="../../../Common/src" destdir="../../../Common/bin" classpathref="lib.path" debug="on"/> <javac srcdir="src" destdir="bin" classpathref="lib.path" debug="on"/> Thank you. Dianne |
|
|
Re: Java source files not part of any packageLook at the include / exclude parameter options
Chris Sent using BlackBerry® from Orange -----Original Message----- From: Dianne Yumul <dianne@...> Date: Tue, 27 Oct 2009 13:31:24 To: <user@...> Subject: Java source files not part of any package Hello Everyone, I'm learning to use Ant 1.7.0 as part of Xcode 3.1.2 on Mac OS X 10.6. We have a separate directory called Common/ where we keep common java source files. These files need to get included, not all at the same time though, when compiling our Java applications. What would be the best way to do this? If I add Common/ to srcdir, it compiles everything inside when I only need a one or two. The FAQ mentions that "If you have Java source files that aren't declared to be part of any package, you can still use the <javac> task to compile these files correctly - just set the srcdir and destdir attributes to the actual directory the source files live in and the directory the class files should go into, respectively." But how to do this exactly? Do I need two separate javac tasks like the following? <javac srcdir="../../../Common/src" destdir="../../../Common/bin" classpathref="lib.path" debug="on"/> <javac srcdir="src" destdir="bin" classpathref="lib.path" debug="on"/> Thank you. Dianne |
|
|
Re: Java source files not part of any packageThanks for the suggestion Chris. I tried using the includes parameter
and it works. Here's what it looks like: <javac destdir="${bin}" includeAntRuntime="no" classpathref="lib.path" debug="${compile.debug}"> <src path="src"/> <src path="../Common"/> <include name="AuthWindow.java"/> <include name="DateFormatField.java"/> <include name="Capacity.java"/> <include name="CapacityPrinter.java"/> </javac> Here's the directory structure: /Common/AuthWindow.java /Common/DateFormatField.java /Common/Capacity.java /Common/CapacityPrinter.java /Edit Capacities/src/Edit_Capacities.java I was hoping for another (better?) way to do this like it says in the FAQ. Thanks again. On Oct 27, 2009, at 1:41 PM, chris.green100@... wrote: > Look at the include / exclude parameter options > > Chris > Sent using BlackBerry® from Orange > > -----Original Message----- > From: Dianne Yumul <dianne@...> > Date: Tue, 27 Oct 2009 13:31:24 > To: <user@...> > Subject: Java source files not part of any package > > Hello Everyone, > > I'm learning to use Ant 1.7.0 as part of Xcode 3.1.2 on Mac OS X > 10.6. We have a separate directory called Common/ where we keep > common java source files. These files need to get included, not all at > the same time though, when compiling our Java applications. What > would be the best way to do this? > > If I add Common/ to srcdir, it compiles everything inside when I only > need a one or two. The FAQ mentions that "If you have Java source > files that aren't declared to be part of any package, you can still > use the <javac> task to compile these files correctly - just set the > srcdir and destdir attributes to the actual directory the source files > live in and the directory the class files should go into, > respectively." But how to do this exactly? Do I need two separate > javac tasks like the following? > > <javac srcdir="../../../Common/src" destdir="../../../Common/bin" > classpathref="lib.path" debug="on"/> > <javac srcdir="src" destdir="bin" classpathref="lib.path" debug="on"/> > > Thank you. > > Dianne > > |
|
|
Re: Java source files not part of any packageDianne Yumul wrote:
> Hello Everyone, > > I'm learning to use Ant 1.7.0 as part of Xcode 3.1.2 on Mac OS X 10.6. > We have a separate directory called Common/ where we keep common java > source files. These files need to get included, not all at the same time > though, when compiling our Java applications. What would be the best > way to do this? > > If I add Common/ to srcdir, it compiles everything inside when I only > need a one or two. The FAQ mentions that "If you have Java source files > that aren't declared to be part of any package, you can still use the > <javac> task to compile these files correctly - just set the srcdir and > destdir attributes to the actual directory the source files live in and > the directory the class files should go into, respectively." But how to > do this exactly? Do I need two separate javac tasks like the following? > > <javac srcdir="../../../Common/src" destdir="../../../Common/bin" > classpathref="lib.path" debug="on"/> > <javac srcdir="src" destdir="bin" classpathref="lib.path" debug="on"/> > that's not going to help, ant will still compile everything in common/ Two options * <copy> only the files you need to somewhere (like build/src and include that in the compile * use the nested <fileset file> elements in <src> inside javac <property name="common.dir" location="../../../Common" /> <javac destdir="${build.classes.dir}"> <src> <fileset file="${common.dir}/Utils.java" /> <fileset file="${common.dir}/Arrays.java" /> </src> Know that Javac will pull in extra java source files if imported, it may compile more than you expect. -steve --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: Java source files not part of any packageThank you Steve for the suggestions. I tried option 2 with the
following: <property name="src" location="src"/> <property name="src.common" location="../../Common"> <javac destdir="${bin}" includeAntRuntime="no" classpathref="lib.path" debug="${compile.debug}"> <src path="src"/> <src> <fileset file="${src.common}/AuthWindow.java"/> </src> </javac> But I get the error /Common/AuthWindow.java is not a directory. Going back to the manual and some more searching. Thanks. On Oct 28, 2009, at 3:51 AM, Steve Loughran wrote: > Dianne Yumul wrote: >> Hello Everyone, >> I'm learning to use Ant 1.7.0 as part of Xcode 3.1.2 on Mac OS X >> 10.6. We have a separate directory called Common/ where we keep >> common java source files. These files need to get included, not all >> at the same time though, when compiling our Java applications. >> What would be the best way to do this? >> If I add Common/ to srcdir, it compiles everything inside when I >> only need a one or two. The FAQ mentions that "If you have Java >> source files that aren't declared to be part of any package, you >> can still use the <javac> task to compile these files correctly - >> just set the srcdir and destdir attributes to the actual directory >> the source files live in and the directory the class files should >> go into, respectively." But how to do this exactly? Do I need two >> separate javac tasks like the following? >> <javac srcdir="../../../Common/src" destdir="../../../Common/bin" >> classpathref="lib.path" debug="on"/> >> <javac srcdir="src" destdir="bin" classpathref="lib.path" >> debug="on"/> > > that's not going to help, ant will still compile everything in common/ > > Two options > > * <copy> only the files you need to somewhere (like build/src and > include that in the compile > > > * use the nested <fileset file> elements in <src> inside javac > > <property name="common.dir" location="../../../Common" /> > > <javac destdir="${build.classes.dir}"> > <src> > <fileset file="${common.dir}/Utils.java" /> > <fileset file="${common.dir}/Arrays.java" /> > </src> > > > Know that Javac will pull in extra java source files if imported, it > may compile more than you expect. > > -steve > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: Java source files not part of any packageAnother option would be going back to running javac twice but with the
includes in the appropriate place: <javac srcdir="${src.common}" destdir="${bin}" includeAntRuntime="no" classpathref="lib.path" debug="${compile.debug}"> <include name="AuthWindow.java"/> <include name="Capacity.java"/> <include name="CapacityPrinter.java"/> <include name="DateFormatField.java"/> </javac> <javac srcdir="${src}" destdir="${bin}" includeAntRuntime="no" classpathref="lib.path" debug="${compile.debug}"> </javac> This way it compiles only what I need from the Common folder and everything from the project's src folder. Is there a disadvantage to doing it this way? Thanks. On Oct 28, 2009, at 10:23 AM, Dianne Yumul wrote: > Thank you Steve for the suggestions. I tried option 2 with the > following: > > <property name="src" location="src"/> > <property name="src.common" location="../../Common"> > > <javac destdir="${bin}" includeAntRuntime="no" > classpathref="lib.path" debug="${compile.debug}"> > <src path="src"/> > <src> > <fileset file="${src.common}/AuthWindow.java"/> > </src> > </javac> > > But I get the error /Common/AuthWindow.java is not a directory. > > Going back to the manual and some more searching. > > Thanks. > > On Oct 28, 2009, at 3:51 AM, Steve Loughran wrote: > >> Dianne Yumul wrote: >>> Hello Everyone, >>> I'm learning to use Ant 1.7.0 as part of Xcode 3.1.2 on Mac OS X >>> 10.6. We have a separate directory called Common/ where we keep >>> common java source files. These files need to get included, not >>> all at the same time though, when compiling our Java >>> applications. What would be the best way to do this? >>> If I add Common/ to srcdir, it compiles everything inside when I >>> only need a one or two. The FAQ mentions that "If you have Java >>> source files that aren't declared to be part of any package, you >>> can still use the <javac> task to compile these files correctly - >>> just set the srcdir and destdir attributes to the actual directory >>> the source files live in and the directory the class files should >>> go into, respectively." But how to do this exactly? Do I need two >>> separate javac tasks like the following? >>> <javac srcdir="../../../Common/src" destdir="../../../Common/bin" >>> classpathref="lib.path" debug="on"/> >>> <javac srcdir="src" destdir="bin" classpathref="lib.path" >>> debug="on"/> >> >> that's not going to help, ant will still compile everything in >> common/ >> >> Two options >> >> * <copy> only the files you need to somewhere (like build/src and >> include that in the compile >> >> >> * use the nested <fileset file> elements in <src> inside javac >> >> <property name="common.dir" location="../../../Common" /> >> >> <javac destdir="${build.classes.dir}"> >> <src> >> <fileset file="${common.dir}/Utils.java" /> >> <fileset file="${common.dir}/Arrays.java" /> >> </src> >> >> >> Know that Javac will pull in extra java source files if imported, >> it may compile more than you expect. >> >> -steve >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscribe@... >> For additional commands, e-mail: user-help@... >> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > > |
| Free embeddable forum powered by Nabble | Forum Help |