You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Vincent Massol <vm...@pivolis.com> on 2003/06/26 08:48:26 UTC

multiple source directories... my turn... :-)

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: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


RE: multiple source directories... my turn... :-)

Posted by Vincent Massol <vm...@pivolis.com>.

> -----Original Message-----
> From: Brett Porter [mailto:bporter@f2network.com.au]
> Sent: 26 June 2003 09:16
> To: Maven Developers List
> Subject: Re: multiple source directories... my turn... :-)
> 
> >>Is that OK? You probably also need some postGoal for copying the
> >>deployed JAR.
> >
> >
> > Not sure why.
> 
> I thought maybe you wanted to build a JAR with a different name -
> otherwise it will always be ${pom.artifactId}-${pom.version}.jar,
which
> will only have 1 value. I probably misunderstood.

Oh no, you're right, but I'll just need to override the maven.final.name
property for that I think.

Thanks
-Vincent



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: multiple source directories... my turn... :-)

Posted by Brett Porter <bp...@f2network.com.au>.
>>Is that OK? You probably also need some postGoal for copying the
>>deployed JAR.
> 
> 
> Not sure why. 

I thought maybe you wanted to build a JAR with a different name - 
otherwise it will always be ${pom.artifactId}-${pom.version}.jar, which 
will only have 1 value. I probably misunderstood.

Cheers,
Brett



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


RE: multiple source directories... my turn... :-)

Posted by Vincent Massol <vm...@pivolis.com>.

> -----Original Message-----
> From: Brett Porter [mailto:bporter@f2network.com.au]
> Sent: 26 June 2003 09:04
> To: Maven Developers List
> Subject: Re: multiple source directories... my turn... :-)
> 
> 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>

ah yeah, I had forgotten about that. Thanks Brett.

> 
> 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.

Not sure why. 

> 
> 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.

That is too complex for end users I think. It's much easier that they
get a single framework-${j2ee.version}.jar jar to put in their
classpath.

Yeah, I know, you're going to tell me I could then use the uberjar
plugin in a top level project to perform the merge... ;-)

Thanks
-Vincent

> 
> - 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: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org
> 
> --
> Web Developer
> f2 network ~ everything essential
> 02 8596 4437
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: multiple source directories... my turn... :-)

Posted by Brett Porter <bp...@f2network.com.au>.
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: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org