I have a question about something I encountered today at work.
I have two projects that are built with ant build script.
Lets call them projectA and projectB.
ProjectA builds projectA.jar, and projectB builds projectB.war, and projectB.ear.
ProjectB.war includes projectA.jar in the web-inf lib directory.
In projectB there is a lib directory and it contains projectA.jar.
In this build scenario the build file for projectB pulls in the projectA.jar directly from projectA and it also pulls in projectA.jar from the projectB lib directory(I know bad practice, but I inherited this project, and am fixing it :)).
So when the war and subsequent ear file are built, in the web-inf lib directory of the projectb.war there are two projectA.jar files.
So the first question is:
How does ant put the war file together? I would think if it is using a temporary directory to store the files for packaging, I would not be able to have two files w/ the same name?
Second:
When I deploy this on OC4J, and look in the directory that contains the exploded ear/war files then there is only 1 projectA.jar file, as I would expect. How does it determine which file is used, not important? I'm just curious.
This was the source of problems as the projectA was building differently on different machines, another problem in itself. But the jar that was selected out of the two was always consistent, a build from one machine would always work and one from another machine would not.
thanks for your help.