You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by David Alves <da...@brnphoenix.com> on 2007/06/27 20:17:36 UTC
filename collisions when compiling
I have two directories of source files that I want to compile. One of
them has
A.java
B.java
C.java
the other one has
A.java
The version of A in the second directory is different from the version
in the first directory. Is there set up my javac task so that it always
takes source files from the second directory if they are present there,
but takes them from the first directory if they are not present? Thanks
in advance for your help.
Regards,
David Alves
Re: filename collisions when compiling
Posted by Tommy Nordgren <to...@comhem.se>.
On 27 jun 2007, at 20.17, David Alves wrote:
> I have two directories of source files that I want to compile. One of
> them has
>
> A.java
>
> B.java
>
> C.java
>
>
>
> the other one has
>
>
>
> A.java
>
>
>
> The version of A in the second directory is different from the version
> in the first directory. Is there set up my javac task so that it
> always
> takes source files from the second directory if they are present
> there,
> but takes them from the first directory if they are not present?
> Thanks
> in advance for your help.
>
>
>
> Regards,
>
> David Alves
>
Put the files in subdirectories whose name matches the package.
for example
com/mypackage1/A.java (class com.mypackage1.A)
and
org/mypackage2/A.java (class org.mypackage2.A)
------
What is a woman that you forsake her, and the hearth fire and the
home acre,
to go with the old grey Widow Maker. --Kipling, harp song of the
Dane women
Tommy Nordgren
tommy.nordgren@comhem.se
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: filename collisions when compiling
Posted by Wayne Cannon <wc...@turinnetworks.com>.
Clarification, since you usually want the full class name, including
package, for class A to remain the same:
For example:
.../common/com/mycompany/myproject/B.java package.class =
com.mycompany.myproject.B
.../common/com/mycompany/myproject/C.java package.class =
com.mycompany.myproject.C
.../case1/com/mycompany/myproject/A.java package.class =
com.mycompany.myproject.A
.../case2/com/mycompany/myproject/A.java package.class =
com.mycompany.myproject.A
Still compile using "common + case1" or "common + case2" directories, as
desired, for your source path.
--Wayne
Wayne Cannon wrote:
> ... or simply name them both non-java, such as A.java.source, and then
> copy the desired one to A.java in its current directory (removing any
> pre-existing A.java copies beforehand). That way, there is only one
> A.java, regardless of directory.
>
> If there are two different cases that are compiled, my solution for
> similar situations (e.g., a family of products with shared classes and
> some classes with minor product-specific variations, but the same
> class name in each product) has been to have separate directories for
> the unique cases and a common directory for the shared files -- then
> compile with the desires sourcepath or equivalent.
>
> For example:
> .../common/B.java
> .../common/C.java
> .../case1/A.java
> .../case2/A.java
>
> Then compile using either "common + case1" or "common + case2"
> directories, as desired. This can be extended hierarchically.
>
> --Wayne
>
>
> Burgess, Benjamin wrote:
>> You could always mange your files ahead of compiling. For example, you
>> could copy everything from the first directory into a temp directory,
>> then copy everything from the second directory into the temp directory
>> overwriting existing files, then compile from the temp directory.
>>
>> Ben
>>
>> -----Original Message-----
>> From: David Alves [mailto:dalves@brnphoenix.com] Sent: Wednesday,
>> June 27, 2007 2:18 PM
>> To: Ant Users List
>> Subject: filename collisions when compiling
>>
>> I have two directories of source files that I want to compile. One of
>> them has
>> A.java
>>
>> B.java
>>
>> C.java
>>
>>
>>
>> the other one has
>>
>>
>> A.java
>>
>>
>>
>> The version of A in the second directory is different from the version
>> in the first directory. Is there set up my javac task so that it always
>> takes source files from the second directory if they are present there,
>> but takes them from the first directory if they are not present? Thanks
>> in advance for your help.
>>
>>
>>
>> Regards,
>>
>> David Alves
>>
>> ********************************************************************************************
>>
>> This message, including any attachments, contains confidential
>> information intended for a specific individual and purpose, and is
>> protected by law. If you are not the intended recipient, please
>> contact the sender immediately by reply e-mail and destroy all copies.
>> You are hereby notified that any disclosure, copying, or distribution
>> of this message, or
>> the taking of any action based on it, is strictly prohibited.
>>
>> TIAA-CREF
>> ********************************************************************************************
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: filename collisions when compiling
Posted by Wayne Cannon <wc...@turinnetworks.com>.
... or simply name them both non-java, such as A.java.source, and then
copy the desired one to A.java in its current directory (removing any
pre-existing A.java copies beforehand). That way, there is only one
A.java, regardless of directory.
If there are two different cases that are compiled, my solution for
similar situations (e.g., a family of products with shared classes and
some classes with minor product-specific variations, but the same class
name in each product) has been to have separate directories for the
unique cases and a common directory for the shared files -- then compile
with the desires sourcepath or equivalent.
For example:
.../common/B.java
.../common/C.java
.../case1/A.java
.../case2/A.java
Then compile using either "common + case1" or "common + case2"
directories, as desired. This can be extended hierarchically.
--Wayne
Burgess, Benjamin wrote:
> You could always mange your files ahead of compiling. For example, you
> could copy everything from the first directory into a temp directory,
> then copy everything from the second directory into the temp directory
> overwriting existing files, then compile from the temp directory.
>
> Ben
>
> -----Original Message-----
> From: David Alves [mailto:dalves@brnphoenix.com]
> Sent: Wednesday, June 27, 2007 2:18 PM
> To: Ant Users List
> Subject: filename collisions when compiling
>
> I have two directories of source files that I want to compile. One of
> them has
>
> A.java
>
> B.java
>
> C.java
>
>
>
> the other one has
>
>
>
> A.java
>
>
>
> The version of A in the second directory is different from the version
> in the first directory. Is there set up my javac task so that it always
> takes source files from the second directory if they are present there,
> but takes them from the first directory if they are not present? Thanks
> in advance for your help.
>
>
>
> Regards,
>
> David Alves
>
> ********************************************************************************************
> This message, including any attachments, contains confidential information intended
> for a specific individual and purpose, and is protected by law. If you are not the intended
> recipient, please contact the sender immediately by reply e-mail and destroy all copies.
> You are hereby notified that any disclosure, copying, or distribution of this message, or
> the taking of any action based on it, is strictly prohibited.
>
> TIAA-CREF
> ********************************************************************************************
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
RE: filename collisions when compiling
Posted by "Burgess, Benjamin" <BB...@tiaa-cref.org>.
You could always mange your files ahead of compiling. For example, you
could copy everything from the first directory into a temp directory,
then copy everything from the second directory into the temp directory
overwriting existing files, then compile from the temp directory.
Ben
-----Original Message-----
From: David Alves [mailto:dalves@brnphoenix.com]
Sent: Wednesday, June 27, 2007 2:18 PM
To: Ant Users List
Subject: filename collisions when compiling
I have two directories of source files that I want to compile. One of
them has
A.java
B.java
C.java
the other one has
A.java
The version of A in the second directory is different from the version
in the first directory. Is there set up my javac task so that it always
takes source files from the second directory if they are present there,
but takes them from the first directory if they are not present? Thanks
in advance for your help.
Regards,
David Alves
********************************************************************************************
This message, including any attachments, contains confidential information intended
for a specific individual and purpose, and is protected by law. If you are not the intended
recipient, please contact the sender immediately by reply e-mail and destroy all copies.
You are hereby notified that any disclosure, copying, or distribution of this message, or
the taking of any action based on it, is strictly prohibited.
TIAA-CREF
********************************************************************************************
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org