You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Calum Shaw-Mackay <ca...@gmail.com> on 2006/04/03 15:20:32 UTC

Multiple compilation and output directories

Hello

I'm just starting out using Maven for some of my projects and I have a
couple of questions

How do I in a my pom.xml indicate that I want a subset of my source
compiled to a separate directory using 1.4, whilst having the whole
source (including the subset) compiled to 1.5 in another directory

Essentially, this is for jini-like projects where you can run the main
application under 1.5 but clients to the service maybe running under
1.4

I then want to add them as separate artifacts; one for the downloaded
files for the service, one for the interfaces that the clients are
compiled against and another for the actual service.

I'm thinking of using profiles, as a start.....

Any help or pointers would be greatly appreciated

Thanks

   --Calum

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


Re: Multiple compilation and output directories

Posted by Wayne Fay <wa...@gmail.com>.
Modules == 2 "projects" or subprojects. Different words for the same
thing, essentially.

The idea is that you put all the jdk1.5 code in one subdirectory
(module), and then the jdk1.4 code in another (module).

Something like:
myproject/pom.xml    with [modules] code15, code14
--myproject/code15/pom.xml
--myproject/code14/pom.xml

This is probably not the only way to get the results you're looking
for, but its certainly the easiest.

Wayne

On 4/3/06, Calum Shaw-Mackay <ca...@gmail.com> wrote:
> Essentially it's exactly the same source root, just need an extra
> specialised compilation step for a subset of the code.
>
> Could I use modules here?
>
> Thanks
>
> --Calum
>
> On 4/3/06, Milos Kleint <Mi...@sun.com> wrote:
> > make it 2  projects, that's the general rule of thumb when you have 2
> > different source roots or have rules for parts of the sourcebase (in
> > which case you need to separate the sources).
> >
> > Milos
> >
> > Calum Shaw-Mackay wrote:
> > > Hello
> > >
> > > I'm just starting out using Maven for some of my projects and I have a
> > > couple of questions
> > >
> > > How do I in a my pom.xml indicate that I want a subset of my source
> > > compiled to a separate directory using 1.4, whilst having the whole
> > > source (including the subset) compiled to 1.5 in another directory
> > >
> > > Essentially, this is for jini-like projects where you can run the main
> > > application under 1.5 but clients to the service maybe running under
> > > 1.4
> > >
> > > I then want to add them as separate artifacts; one for the downloaded
> > > files for the service, one for the interfaces that the clients are
> > > compiled against and another for the actual service.
> > >
> > > I'm thinking of using profiles, as a start.....
> > >
> > > Any help or pointers would be greatly appreciated
> > >
> > > Thanks
> > >
> > >    --Calum
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Multiple compilation and output directories

Posted by Calum Shaw-Mackay <ca...@gmail.com>.
Essentially it's exactly the same source root, just need an extra
specialised compilation step for a subset of the code.

Could I use modules here?

Thanks

--Calum

On 4/3/06, Milos Kleint <Mi...@sun.com> wrote:
> make it 2  projects, that's the general rule of thumb when you have 2
> different source roots or have rules for parts of the sourcebase (in
> which case you need to separate the sources).
>
> Milos
>
> Calum Shaw-Mackay wrote:
> > Hello
> >
> > I'm just starting out using Maven for some of my projects and I have a
> > couple of questions
> >
> > How do I in a my pom.xml indicate that I want a subset of my source
> > compiled to a separate directory using 1.4, whilst having the whole
> > source (including the subset) compiled to 1.5 in another directory
> >
> > Essentially, this is for jini-like projects where you can run the main
> > application under 1.5 but clients to the service maybe running under
> > 1.4
> >
> > I then want to add them as separate artifacts; one for the downloaded
> > files for the service, one for the interfaces that the clients are
> > compiled against and another for the actual service.
> >
> > I'm thinking of using profiles, as a start.....
> >
> > Any help or pointers would be greatly appreciated
> >
> > Thanks
> >
> >    --Calum
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: Multiple compilation and output directories

Posted by Milos Kleint <Mi...@Sun.COM>.
make it 2  projects, that's the general rule of thumb when you have 2 
different source roots or have rules for parts of the sourcebase (in 
which case you need to separate the sources).

Milos

Calum Shaw-Mackay wrote:
> Hello
>
> I'm just starting out using Maven for some of my projects and I have a
> couple of questions
>
> How do I in a my pom.xml indicate that I want a subset of my source
> compiled to a separate directory using 1.4, whilst having the whole
> source (including the subset) compiled to 1.5 in another directory
>
> Essentially, this is for jini-like projects where you can run the main
> application under 1.5 but clients to the service maybe running under
> 1.4
>
> I then want to add them as separate artifacts; one for the downloaded
> files for the service, one for the interfaces that the clients are
> compiled against and another for the actual service.
>
> I'm thinking of using profiles, as a start.....
>
> Any help or pointers would be greatly appreciated
>
> Thanks
>
>    --Calum
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>   


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


Re: Multiple compilation and output directories

Posted by Eric Redmond <er...@gmail.com>.
On 4/3/06, Calum Shaw-Mackay <ca...@gmail.com> wrote:
>
> Hello
>
> I'm just starting out using Maven for some of my projects and I have a
> couple of questions
>
> How do I in a my pom.xml indicate that I want a subset of my source
> compiled to a separate directory using 1.4, whilst having the whole
> source (including the subset) compiled to 1.5 in another directory


Essentially, this is for jini-like projects where you can run the main
> application under 1.5 but clients to the service maybe running under
> 1.4
>
> I then want to add them as separate artifacts; one for the downloaded
> files for the service, one for the interfaces that the clients are
> compiled against and another for the actual service.
>
> I'm thinking of using profiles, as a start.....
>
> Any help or pointers would be greatly appreciated
>
> Thanks
>
>    --Calum


Maven does not generally condone this. It actually explicitly removes
certain elements around source and output directories that exist in the
<project><build /></project> element from <profile><build /></profile>
element. (Profile being the block that would allow a jdk1.5 build to differ
from a jdk1.4 build). This means that you cannot create a structure like:
src/main/java14 to be active under one profile, and src/main/java15 under
another. If you find yourself seperating source code, its time to think
about seperating them into seperate projects.

I'm not saying it's not possible (anything is, you can always write a
plugin, or hack it with an ant plugin configuration), but Maven is more than
about being easy to use, but also clean up and standardize the projects that
use it. Trust me, its far simpler to just accept that Maven will make
certain demands of your project structure in order for it to play nice back.
Its like a volcano god that demands tribute: It will keep your project nice
and green, all it asks is for in return the occasional virgin. Ultimately,
it makes things easier in the long run.

Eric