On 02/12/06, lars vonk <[EMAIL PROTECTED]> wrote:

Petar,

If I understand yoy correctly ModuleB and ModuleC are two artifacts
both dependent on ModuleA. If so then you can create two projects for
B and C which have a dependency on A. For replacing contents of files
you can use filtering (see

http://maven.apache.org/guides/getting-started/index.html#How%20do%20I%20filter%20resource%20files?
)

Hope this helps,

Lars

On 12/2/06, Petar Tahchiev <[EMAIL PROTECTED]> wrote:
> Hello to everybody,
>
> I am currently trying to refactor a source tree that used to be built
with
> Ant. The source tree contains of three modules ModuleA, ModuleB and
ModuleC.
> At startup a property is being given, and based on that property only
one of
> these modules is being built. The problem is that module A contains all
of
> the common files, which are used by the other two modules. ModuleB and
> ModuleC on the other hand have just two or three files that are specific
for
> the build being made, and which should replace the corresponding files
in
> ModuleA. This project used to be built with Ant and there it's not a big
> deal to copy to your working directory everything from ModuleA, and then
> overwrite the existing files with the ones in ModuleB or ModuleC. Now I
try
> to port the project to use Maven and I am currently facing this problem:
how
> to merge the two source-trees from moduleA and one of these: moduleB or
> ModuleC?
>
> I tried something like this:
> <build>
>         <sourceDirectory>../moduleA/src/java</sourceDirectory>
>         <sourceDirectory>../moduleB/src/java</sourceDirectory>
> </build>
> but the roblem is that I cannot have more than one sourceDirectory tag.
I am
> currently stuck and any help would be appreciated.
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Hello Lars,

first of all I want to thank you for replying. I really apreciate it. Let me
make it more clear. When the built is started a property is passed - the
property is 12, 13, or 14 and based on that property we decide which
artifact is propduced. If 12 is sent then we build moduleA and nothing
special here - I mean we have the source code in moduleA/src/main/java and
we just compile it, package it as a regular attifact. On the other hand the
problem arises if the property is 13 - then we have to build moduleB, but
here is the tricky part: moduleB have only one or two classes that should be
copied to the sources of moduleA(preserving their package structure) and the
whole fileset (including moduleA's sources)then being used as a source
directory. So at the end we produce only one artifact. In each case the jar
we produce must have all of the classes from moduleA, and depending which
module we have built it may contain additionally the classes from moduleB or
moduleC.

Yes you are right - I can make moduleB and moduleC with dependency on
moduleA, and they would compile without problems - bu at the end when
packaging them I would generate jars with just two classes in.
I looked at the filter page you send me, but as I understand filtering is
only appopriate when you deal with resources(I may be wrong about this).
I think I can manage this by using profiles, but I still can't avoid the
need of copying my source files, or simply telling Maven to use multiple
source directories(the ones in moduleA/src/main and in moduleB/main/src).

Any ideas would be great appreciated.


--
Regards, Petar!

Reply via email to