I think you are looking for:

<preGoal name="java:compile">
      <ant:path id="maven.j2ee.compile.src.set"
            location="${pom.build.sourceDirectory}/../${j2ee.version}"/>



      <maven:addPath id="maven.compile.src.set"
                     refid="maven.j2ee.compile.src.set"/>
</preGoal>

Where your sourceDirectory is src/java/share, and j2ee.version=j2ee12 for example.

Is that OK? You probably also need some postGoal for copying the deployed JAR.

I'm not sure how it works out with tests though - you could check that it is using a set for its compiles as well.

Ideally here I think you have framework-shared.jar, framework-j2ee12.jar and framework-j2ee13.jar.

- Brett

Vincent Massol wrote:
Hi,

We are trying to Mavenize the cactus build and Cactus has the following
directory structure for the framework subproject:

framework
|_ src
|_ java
|_ j2ee12 (j2ee 1.2 specific source code)
|_ j2ee13 (j2ee 1.3 specific source code)
|- share (source code common to j2ee 1.2 and 1.3)
|_ test
|_ j2ee12
|_ j2ee13
|- share [...]


This is really one source tree in practice but split over different
directories as we need to support different APIs.

I can see 3 solutions but I don't like them:

Solution 1: Create 3 framework projects

framework-share/
framework-j2ee12/
framework-j2ee13/

Solution 2: Use a preGoal in maven.xml to copy the files to a common
location.


I prefer solution 2 but what I don't like is that it involves an extra
copying step which will slow the build even more (and it's already
taking 18 minutes for a full Cactus build with Ant - not just the
framework project of course).

Solution 3: Put everything in the same source tree, use factory classes
and reflection, with some tricks to make sure some classes are not
loaded in memory when the J2EE version is not the correct one. At this
point in time, this is really too complex and I'm not even sure it is
the right approach. The current solution is more tailored to a specific
need. If I'm working with J2EE 1.3, I don't care about J2EE 1.2 for
example.

Are there any other solutions that I'm not aware of?

Isn't this a valid case?

I'm not sure what codeswitcher is. Would it help?

Thanks
-Vincent


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

-- Web Developer f2 network ~ everything essential 02 8596 4437


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



Reply via email to