Having .java files in directories which do not correspond with the package
name is not going to work well, especially with <javac>. The "best
practices" for this is to have a source directory and a test cases
directory - each with the same directory structure.
You will make your life much simpler if you follow this convention.
Erik
----- Original Message -----
From: "Sameer Singh" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, May 25, 2002 9:52 PM
Subject: uptodate problem
> Hi,
>
> I have the following src directory:
>
> c:/work/mms/apps/mmsapi/src/com/openwave/mms/album/CM.java
>
> The unit test cases are one level below in
>
> c:/work/mms/apps/mmsapi/src/com/openwave/mms/album/test/TestCM.java
>
>
> both CM.java and TestCM.java belong to package com.openwave.mms.album;
>
>
>
> The sources are built in -->
>
> c:/work/mms/apps/mmsapi/build &
>
> Rhe unit tests are built in --->
>
> c:/work/mms/apps/mmsapi/test
>
> To get the dependencies right, I have to compare the timestamp of
>
> c:/work/mms/apps/mmsapi/src/com/openwave/mms/album/test/TestCM.java
>
> to that of
>
> c:/work/mms/apps/mmsapi/test/com/openwave/mms/album/TestCM.class
> ^^^^ ^^^^^^
>
> Accordingly I use the following target:
>
> -----------------------------------------------------------
>
> <target name="test-setup" depends="setup">
> <available classname="junit.framework.TestCase"
property="junit.present"
> />
> <mkdir dir="test" />
> <uptodate property="test-recompile-needed">
> <srcfiles dir="src" includes="**/test/Test*.java"/>
> <mapper type="regexp" from="^(.*)\\test\\(Test.*)\.java$$"
> to="\1/\2.class"/>
> </uptodate>
> </target>
>
> -------------------------------------------------------------
>
> which only works partially,
>
> \1 in the above case matches only com/openwave/mms/album and NOT
> c:/work/mms/apps/mmsapi/src/com/openwave/mms/album. If it did match
> the full path name then I would have been able to achieve what I'm looking
> for with the following mapper:
>
> <mapper type="regexp" from="^(.*)\\src\\(.*)\\test\\(Test.*)\.java$$"
> to="\1/test/\2/\3.class"/>
>
>
> The prefix before that i.e. c:/work/mms/apps/mmsapi/src/ seems to be
> "automatically" appended and so the target maps to
>
> c:/work/mms/apps/mmsapi/src/com/openwave/mms/album/TestCM.class
> ^^^
> instead of
>
> c:/work/mms/apps/mmsapi/test/com/openwave/mms/album/TestCM.class
>
> which will never get created at that location and so it recompiles
> everytime.
>
> ------------------------------------------------------------
>
> I expected the "from" field to contain the entire path name, however,
> this does not seem to be the case.
>
> Does anybody have any ideas on how I can get around this (without
> ofcourse changing my directory structure, package name or build
> directories).
>
> Thanks a lot.
>
> Regards
>
> Sameer
>
>
>
>
>
>
>
>
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>