You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Javier Arias <xa...@yahoo.com> on 2010/11/24 11:30:10 UTC

multi-platform multi-module project/modules structure

Hello all,
I am migrating our ant based projects to maven and I have doubts about the 
correct project structure. We have a complex project strutcture with many 
dependencies between projects that we do not know how to map to maven. I know 
this is a long mail, but i ask for your patience to help me. Thank you in 
advance.

Our project is a java multiplatform (j2me and j2se) and divided by different 
responsibilities:
+ frontend, the frontend of the application.
+ backend access, classes that read/write data to the servers.
+ commons project, classes like utitilties used by both backend access and 
frontend.

Also we sliced our classes by the target platform:
+ crossplatform - classes that work in both j2me and j2se
+ j2me - classes specific to j2me platform
+ j2se - classes specific to j2se platform

So, our current structure is divided into 9 independent projects:

- crosplatform-frontend (classes that are frontend related and are used into 
both j2me and j2se)
- crosplatform-commons
- crosplatform-backend
- j2me-frontend (classes that are frontend related and are j2me specific)
- j2me-commons
- j2me-backend
- j2se-frontend (classes that are frontend related and are j2se specific)
-  j2se-commons
-  j2se-backend

So, as you can imagine, we have lots of dependencies (no circular dependencies) 
between our projects and we have to build processes for the two different 
platforms (also the number of jar files and libraries used are different).

+ j2me build, includes projects: 
                   - crosplatform-frontend, crosplatform-commons, 
crosplatform-backend
                   - j2me-frontend, j2me-commons, j2me-backend

+ j2se build, includes projects: 
                   - crosplatform-frontend, crosplatform-commons, 
crosplatform-backend
                   - j2se-frontend, j2se-commons, j2se-backend

So, here are my questions, I am new to maven, so some options may be just wong:
+ which would be the best project structure? 
       - nine independent projects and two sepparate projects for the building? 
       - three projects dividing by platform?(eg. cross-platform, j2me, j2se) 
each one with three modules? (frontend, commons, backend)
       - only one project with nine modules and two different build targets?
+ what are the best practices for this kind of problem?
+ is it possible to specify the project/module target just to be the compiled 
classes and then pack them as needed from an exteernal module or project?

Thank you very much. Best regards.
Javier Arias.


      

Re: multi-platform multi-module project/modules structure

Posted by Antonio Petrelli <an...@gmail.com>.
2010/11/26 Javier Arias <xa...@yahoo.com>:
> I didn't think on that option, why is it better than having nine modules?
I just guessed that the j2me/j2se are very specific to the assemblies
you want to create for j2me and j2se.
IOW, I guessed that those modules will not be used elsewhere (am I right?).
This deep-modular structure allows you to release the whole project in
one go. This is correct if you *want* to manage them this way.
You can still think about releasing some projects separately, it
depends on your release cycle.

> on the other side, is it possible to specify that packaging for one module is just to
> compile (leave the .class files on the target) since packaging for each platform
> will be just one jar. How is it managed by maven?

So, if I understood you well, you want to collect the classes in one
big jar, right?
You have two options:
1. using the pre-defined "jar-with-dependencies" assembly descriptor:
http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html#jar-with-dependencies
2. using the Maven Shade plugin to create an Uberjar:
http://maven.apache.org/plugins/maven-shade-plugin/

HTH
Antonio

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


Re: multi-platform multi-module project/modules structure

Posted by Javier Arias <xa...@yahoo.com>.
Thank you, Antonio,
I didn't think on that option, why is it better than having nine modules? on the 
other side, is it possible to specify that packaging for one module is just to 
compile (leave the .class files on the target) since packaging for each platform 
will be just one jar. How is it managed by maven?
Best regards.
Javier arias.




________________________________
From: Antonio Petrelli <an...@gmail.com>
To: Maven Users List <us...@maven.apache.org>
Sent: Fri, November 26, 2010 10:23:29 AM
Subject: Re: multi-platform multi-module project/modules structure

2010/11/24 Javier Arias <xa...@yahoo.com>:
> So, here are my questions, I am new to maven, so some options may be just 
wong:
> + which would be the best project structure?
>       - nine independent projects and two sepparate projects for the building?
>       - three projects dividing by platform?(eg. cross-platform, j2me, j2se)
> each one with three modules? (frontend, commons, backend)
>       - only one project with nine modules and two different build targets?
> + what are the best practices for this kind of problem?

None of the above :-D I suppose that you want to maintain and release
them at the same time. So create a project with:
1. the three crossplatform modules;
2. two modular modules, one for each platform, containing the specific
j2se/j2me modules plus an assembly module.

Antonio

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


      

Re: multi-platform multi-module project/modules structure

Posted by Antonio Petrelli <an...@gmail.com>.
2010/11/24 Javier Arias <xa...@yahoo.com>:
> So, here are my questions, I am new to maven, so some options may be just wong:
> + which would be the best project structure?
>       - nine independent projects and two sepparate projects for the building?
>       - three projects dividing by platform?(eg. cross-platform, j2me, j2se)
> each one with three modules? (frontend, commons, backend)
>       - only one project with nine modules and two different build targets?
> + what are the best practices for this kind of problem?

None of the above :-D I suppose that you want to maintain and release
them at the same time. So create a project with:
1. the three crossplatform modules;
2. two modular modules, one for each platform, containing the specific
j2se/j2me modules plus an assembly module.

Antonio

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


Re: multi-platform multi-module project/modules structure

Posted by Javier Arias <xa...@yahoo.com>.
Hello everybody,
please, can anyone answer this questions, or give me some online references 
provinding advice on how to solve a similar problem?
I searched online but found nothing relevant.
Thank you very much.
Best regards.
Javier arias.





________________________________
From: Javier Arias <xa...@yahoo.com>
To: users@maven.apache.org
Sent: Wed, November 24, 2010 11:30:10 AM
Subject: multi-platform multi-module project/modules structure

Hello all,
I am migrating our ant based projects to maven and I have doubts about the 
correct project structure. We have a complex project strutcture with many 
dependencies between projects that we do not know how to map to maven. I know 
this is a long mail, but i ask for your patience to help me. Thank you in 
advance.

Our project is a java multiplatform (j2me and j2se) and divided by different 
responsibilities:
+ frontend, the frontend of the application.
+ backend access, classes that read/write data to the servers.
+ commons project, classes like utitilties used by both backend access and 
frontend.

Also we sliced our classes by the target platform:
+ crossplatform - classes that work in both j2me and j2se
+ j2me - classes specific to j2me platform
+ j2se - classes specific to j2se platform

So, our current structure is divided into 9 independent projects:

- crosplatform-frontend (classes that are frontend related and are used into 
both j2me and j2se)
- crosplatform-commons
- crosplatform-backend
- j2me-frontend (classes that are frontend related and are j2me specific)
- j2me-commons
- j2me-backend
- j2se-frontend (classes that are frontend related and are j2se specific)
-  j2se-commons
-  j2se-backend

So, as you can imagine, we have lots of dependencies (no circular dependencies) 
between our projects and we have to build processes for the two different 
platforms (also the number of jar files and libraries used are different).

+ j2me build, includes projects: 
                   - crosplatform-frontend, crosplatform-commons, 
crosplatform-backend
                   - j2me-frontend, j2me-commons, j2me-backend

+ j2se build, includes projects: 
                   - crosplatform-frontend, crosplatform-commons, 
crosplatform-backend
                   - j2se-frontend, j2se-commons, j2se-backend

So, here are my questions, I am new to maven, so some options may be just wong:
+ which would be the best project structure? 
       - nine independent projects and two sepparate projects for the building? 
       - three projects dividing by platform?(eg. cross-platform, j2me, j2se) 
each one with three modules? (frontend, commons, backend)
       - only one project with nine modules and two different build targets?
+ what are the best practices for this kind of problem?
+ is it possible to specify the project/module target just to be the compiled 
classes and then pack them as needed from an exteernal module or project?

Thank you very much. Best regards.
Javier Arias.