You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Peter Butkovic <pu...@gmail.com> on 2010/05/05 09:30:09 UTC
maven multi-module project structure
hi all,
I have a question to maven modules structure.
I'm kinda new to maven and trying to migrate our ant based projects to maven.
I've seen http://www.sonatype.com/books/mvnref-book/reference/pom-relationships-sect-multi-vs-inherit.html
but all dependencies seems to be tree-like therefor I need to know
experienced opinion to my question:
Imagine I have situation like this:
- root_project (pom) - contains submodules - client and server
- client (pom - contains submodules), has parent root_project
- server (pom - contains submodules), has parent root_project
- core_api (used by client and server as well) (jar), has parent root_project
is it OK to make core_api submodule of client and server as well? then
I won't have tree structure.Or should I prefer making core_api a
submodule of root_project?
thanks in advance.
pb
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: maven multi-module project structure
Posted by Ron Wheeler <rw...@artifact-software.com>.
I am not a big fan of the "big bang" theory of software development.
I prefer to have a set of core apis that are compiled, tested and
deployed into a repository (nexus in my case) on their own and
referenced by the poms that produce the executable artifacts.
We also have poms that only produce consolidated jars of third party
software so that the modules have a smaller set of dependencies that
reference our poms and our shared poms control the versions of the third
party software.
<dependencies>
<dependency>
<groupId>com.artifact-software.lms</groupId>
<artifactId>lms-pom-mysql-hibernate-spring</artifactId>
<version>${project.version}</version>
</dependency>
This will get you the "official" versions of all of the Spring,
Hibernate and MySQL jars that are packaged up by the POM for
the lms-pom-mysql-hibernate-spring.jar. This jar is also deployed as a
shared jar under tomcat so it only appears once on the server.
The person developing the main module does not have to be aware of the
versions of the third party artifacts and the project poms are really
small even in a project that uses around 60 individual 3rd party
libraries. They only have to know what version of our application they
are building.
Ron
On 05/05/2010 6:47 AM, Peter Butkovic wrote:
> Hello,
>
> I'd need some more clarification in case I use module structure proposed:
>
> does it mean I'd have in server/pom.xml as well as in client/pom.xml?
> <dependencies>
> <dependency>
> <groupId>core-api</groupId>
> <artifactId>core-api</artifactId>
> <version>0.0.1-SNAPSHOT</version>
> </dependency>
>
> or something similar that would match name+version of core-api
>
> I'd like to have automatically built core-api in case I do some
> updates in it and then I build server or client module using:
> mvn site (but in client or server module, not in the root one)
>
> As for example, server developer doesn't need client to be built (as
> it's quite time consuming), but needs only server and core-api.
>
> Do you have any suggestion? Did I get it correctly or am I missing
> some important point?
>
> Thanks
>
> Peter B.
>
>
>
>
> On Wed, May 5, 2010 at 12:20 PM, Peter Butkovic<pu...@gmail.com> wrote:
>
>> Hello,
>>
>> thanks for fast reply! I'll follow your proposal.
>>
>> Peter B.
>>
>>
>> On Wed, May 5, 2010 at 10:42 AM, Karl Heinz Marbaise<ka...@soebes.de> wrote:
>>
>>> Hi,
>>>
>>> i would suggest to create the following structure. Mor
>>>
>>>
>>> pom.xml (root) (modules: client, server, core-api)
>>> +---- client
>>> +-- pom.xml (parent: root: dependency: core-api)
>>> +---- server
>>> +-- pom.xml (parent: root: dependeny: core-api)
>>> +---- core-api
>>> +-- pom.xml (parent: root)
>>>
>>>
>>> The question about core-api is that you don't positioned core-api under
>>> client nor under server, cause it's used by both so you have to put it on
>>> the same level.
>>>
>>> Kind regards
>>> Karl Heinz Marbaise
>>> --
>>> View this message in context: http://old.nabble.com/maven-multi-module-project-structure-tp28457606p28458206.html
>>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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: maven multi-module project structure
Posted by Peter Butkovic <pu...@gmail.com>.
Hi,
thanks for clarification.
I think I have no other option than the one you proposed.
Peter B.
On Wed, May 5, 2010 at 4:00 PM, Kalpak Gadre <ka...@gmail.com> wrote:
> I haven't worked with a lot of multi-module projects, but the way it works
> if I understand it right is that your core-api will be built and installed
> into the local repository. Now whenever you will build the client / server
> from the relevant directory, It will *not* rebuild the core-api. It will
> pick up the core-api-0.0.1-SNAPSHOT.jar file from your local repository
> (.m2/repository/ directory). You will have to make sure that you manually
> build core-api every time it is updated.
>
> Other way to handle this could be using your local repository (nexus /
> artifactory) along with Continuous Integration. Where CI builds the core-api
> and installs it into the local repository. The client / server developer
> just refers to the local maven repository. I think there is a way to tell
> Maven to update the dependencies every time from a repository. This will
> make sure that developers would always get the latest SNAPSHOT dependencies
> when they build and they do not have to build the whole project after every
> SCM update.
>
> I wonder if there is a simpler way?
>
> Thanks,
>
> Kalpak
>
>> Hello,
>>
>> I'd need some more clarification in case I use module structure proposed:
>>
>> does it mean I'd have in server/pom.xml as well as in client/pom.xml?
>> <dependencies>
>> <dependency>
>> <groupId>core-api</groupId>
>> <artifactId>core-api</artifactId>
>> <version>0.0.1-SNAPSHOT</version>
>> </dependency>
>>
>> or something similar that would match name+version of core-api
>>
>> I'd like to have automatically built core-api in case I do some
>> updates in it and then I build server or client module using:
>> mvn site (but in client or server module, not in the root one)
>>
>> As for example, server developer doesn't need client to be built (as
>> it's quite time consuming), but needs only server and core-api.
>>
>> Do you have any suggestion? Did I get it correctly or am I missing
>> some important point?
>>
>> Thanks
>>
>> Peter B.
>>
>>
>>
>>
>> On Wed, May 5, 2010 at 12:20 PM, Peter Butkovic<pu...@gmail.com> wrote:
>>
>>>
>>> Hello,
>>>
>>> thanks for fast reply! I'll follow your proposal.
>>>
>>> Peter B.
>>>
>>>
>>> On Wed, May 5, 2010 at 10:42 AM, Karl Heinz Marbaise<ka...@soebes.de>
>>> wrote:
>>>
>>>>
>>>> Hi,
>>>>
>>>> i would suggest to create the following structure. Mor
>>>>
>>>>
>>>> pom.xml (root) (modules: client, server, core-api)
>>>> +---- client
>>>> +-- pom.xml (parent: root: dependency: core-api)
>>>> +---- server
>>>> +-- pom.xml (parent: root: dependeny: core-api)
>>>> +---- core-api
>>>> +-- pom.xml (parent: root)
>>>>
>>>>
>>>> The question about core-api is that you don't positioned core-api under
>>>> client nor under server, cause it's used by both so you have to put it
>>>> on
>>>> the same level.
>>>>
>>>> Kind regards
>>>> Karl Heinz Marbaise
>>>> --
>>>> View this message in context:
>>>> http://old.nabble.com/maven-multi-module-project-structure-tp28457606p28458206.html
>>>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: maven multi-module project structure
Posted by Kalpak Gadre <ka...@gmail.com>.
I haven't worked with a lot of multi-module projects, but the way it
works if I understand it right is that your core-api will be built and
installed into the local repository. Now whenever you will build the
client / server from the relevant directory, It will *not* rebuild the
core-api. It will pick up the core-api-0.0.1-SNAPSHOT.jar file from your
local repository (.m2/repository/ directory). You will have to make sure
that you manually build core-api every time it is updated.
Other way to handle this could be using your local repository (nexus /
artifactory) along with Continuous Integration. Where CI builds the
core-api and installs it into the local repository. The client / server
developer just refers to the local maven repository. I think there is a
way to tell Maven to update the dependencies every time from a
repository. This will make sure that developers would always get the
latest SNAPSHOT dependencies when they build and they do not have to
build the whole project after every SCM update.
I wonder if there is a simpler way?
Thanks,
Kalpak
> Hello,
>
> I'd need some more clarification in case I use module structure proposed:
>
> does it mean I'd have in server/pom.xml as well as in client/pom.xml?
> <dependencies>
> <dependency>
> <groupId>core-api</groupId>
> <artifactId>core-api</artifactId>
> <version>0.0.1-SNAPSHOT</version>
> </dependency>
>
> or something similar that would match name+version of core-api
>
> I'd like to have automatically built core-api in case I do some
> updates in it and then I build server or client module using:
> mvn site (but in client or server module, not in the root one)
>
> As for example, server developer doesn't need client to be built (as
> it's quite time consuming), but needs only server and core-api.
>
> Do you have any suggestion? Did I get it correctly or am I missing
> some important point?
>
> Thanks
>
> Peter B.
>
>
>
>
> On Wed, May 5, 2010 at 12:20 PM, Peter Butkovic<pu...@gmail.com> wrote:
>
>> Hello,
>>
>> thanks for fast reply! I'll follow your proposal.
>>
>> Peter B.
>>
>>
>> On Wed, May 5, 2010 at 10:42 AM, Karl Heinz Marbaise<ka...@soebes.de> wrote:
>>
>>> Hi,
>>>
>>> i would suggest to create the following structure. Mor
>>>
>>>
>>> pom.xml (root) (modules: client, server, core-api)
>>> +---- client
>>> +-- pom.xml (parent: root: dependency: core-api)
>>> +---- server
>>> +-- pom.xml (parent: root: dependeny: core-api)
>>> +---- core-api
>>> +-- pom.xml (parent: root)
>>>
>>>
>>> The question about core-api is that you don't positioned core-api under
>>> client nor under server, cause it's used by both so you have to put it on
>>> the same level.
>>>
>>> Kind regards
>>> Karl Heinz Marbaise
>>> --
>>> View this message in context: http://old.nabble.com/maven-multi-module-project-structure-tp28457606p28458206.html
>>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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: maven multi-module project structure
Posted by Peter Butkovic <pu...@gmail.com>.
Hello,
I'd need some more clarification in case I use module structure proposed:
does it mean I'd have in server/pom.xml as well as in client/pom.xml?
<dependencies>
<dependency>
<groupId>core-api</groupId>
<artifactId>core-api</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
or something similar that would match name+version of core-api
I'd like to have automatically built core-api in case I do some
updates in it and then I build server or client module using:
mvn site (but in client or server module, not in the root one)
As for example, server developer doesn't need client to be built (as
it's quite time consuming), but needs only server and core-api.
Do you have any suggestion? Did I get it correctly or am I missing
some important point?
Thanks
Peter B.
On Wed, May 5, 2010 at 12:20 PM, Peter Butkovic <pu...@gmail.com> wrote:
> Hello,
>
> thanks for fast reply! I'll follow your proposal.
>
> Peter B.
>
>
> On Wed, May 5, 2010 at 10:42 AM, Karl Heinz Marbaise <ka...@soebes.de> wrote:
>>
>> Hi,
>>
>> i would suggest to create the following structure. Mor
>>
>>
>> pom.xml (root) (modules: client, server, core-api)
>> +---- client
>> +-- pom.xml (parent: root: dependency: core-api)
>> +---- server
>> +-- pom.xml (parent: root: dependeny: core-api)
>> +---- core-api
>> +-- pom.xml (parent: root)
>>
>>
>> The question about core-api is that you don't positioned core-api under
>> client nor under server, cause it's used by both so you have to put it on
>> the same level.
>>
>> Kind regards
>> Karl Heinz Marbaise
>> --
>> View this message in context: http://old.nabble.com/maven-multi-module-project-structure-tp28457606p28458206.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> 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: maven multi-module project structure
Posted by Peter Butkovic <pu...@gmail.com>.
Hello,
thanks for fast reply! I'll follow your proposal.
Peter B.
On Wed, May 5, 2010 at 10:42 AM, Karl Heinz Marbaise <ka...@soebes.de> wrote:
>
> Hi,
>
> i would suggest to create the following structure. Mor
>
>
> pom.xml (root) (modules: client, server, core-api)
> +---- client
> +-- pom.xml (parent: root: dependency: core-api)
> +---- server
> +-- pom.xml (parent: root: dependeny: core-api)
> +---- core-api
> +-- pom.xml (parent: root)
>
>
> The question about core-api is that you don't positioned core-api under
> client nor under server, cause it's used by both so you have to put it on
> the same level.
>
> Kind regards
> Karl Heinz Marbaise
> --
> View this message in context: http://old.nabble.com/maven-multi-module-project-structure-tp28457606p28458206.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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: maven multi-module project structure
Posted by Karl Heinz Marbaise <ka...@soebes.de>.
Hi,
i would suggest to create the following structure. Mor
pom.xml (root) (modules: client, server, core-api)
+---- client
+-- pom.xml (parent: root: dependency: core-api)
+---- server
+-- pom.xml (parent: root: dependeny: core-api)
+---- core-api
+-- pom.xml (parent: root)
The question about core-api is that you don't positioned core-api under
client nor under server, cause it's used by both so you have to put it on
the same level.
Kind regards
Karl Heinz Marbaise
--
View this message in context: http://old.nabble.com/maven-multi-module-project-structure-tp28457606p28458206.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org