You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Shakun Gupta <sh...@customerxps.com> on 2008/08/25 12:28:28 UTC

how to manage two different projects with similar project structures

Hi,

I have created two different projects, say "A" & "B". Both contain a 
module, say "M". When i run, /mvn install /in both the projects, M gets 
installed in my local repository at two different locations, but with 
the same name, say M-1.0.0.jar. Now, if I add the modules M as 
dependencies to my 3rd application, say "D", in the final war of D, only 
one M is there.
Is there a  way to change the name of M-1.0.0.jar of A to A-M-1.0.0.jar 
or some similar name, without explicitly renaming the folder name of 
module M to A-M and B-M.

Regards,
Shakun

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


Re: how to manage two different projects with similar project structures

Posted by Wayne Fay <wa...@gmail.com>.
Unless something has changed (regression), this is automatically
handled by recent releases of the EAR and WAR plugins (jars are
renamed to be unique). Give it a try and report back.

Wayne

On 8/26/08, Shakun Gupta <sh...@customerxps.com> wrote:
> Hi Guillaume,
>
> Sorry, I did not provide a bit of clarification while asking the question.
> Actually, all our projects have a similar structure.
> For ex : -
> A (groupId)
>   - entities (artifactId)
>   - utilities (artifactId)
>   etc..
>
> B (groupId)
>   - entities (artifactId)
>   - utilities (artifactId)
>   etc..
>
> Entities in A is totally different from entities in B, so I can not share
> entities. When i run /*mvn install, */entities are installed in the
> .m2/respository as follows :
>
> A (groupId)
>   - entities (artifactId)
>      - 1.0.0
>         - entities-1.0.0.jar
>   - etc..
> B (groupId)
>   - entities (artifactId)
>      - 1.0.0
>         - entities-1.0.0.jar
>   - etc..
>
> So, now if my another project D (also following the same structure), depends
> on both A and B, and I deploy a web-app, then there is a conflict between
> the entities-1.0.0.jar.
>
> I can do one thing as renaming entities in A to A-entities and so on to
> avoid the conflict. Is there a better way? I am not sure if the folder name
> (entities) can be different from the artifactId.
>
> Regards,
> Shakun
>
> Jeudy, Guillaume wrote:
> >
> > An artifact is uniquely identified by its groupId, artifactId, version and
> classifier.
> >  In your case I hope your groupId, artifactId is different because your
> 'M' module really(i deduce) is a different module for 'A' & 'B' projects.
> >  If your M module is a shared module then I suggest that either 'A' or 'B'
> refer to the other 'M' rather than installing it's own 'M'. You might also
> want to move out M module in its own project and have both A and B refer to
> it. You'll have to take into account the lifecycles of your projects and
> decide what makes the most sense to do.
> >  -GJ
> >
> > ________________________________
> >
> > From: Shakun Gupta [mailto:shakun@customerxps.com]
> > Sent: Mon 25/08/2008 6:28 AM
> > To: Maven Users List
> > Subject: how to manage two different projects with similar project
> structures
> >
> >
> >
> > Hi,
> >
> > I have created two different projects, say "A" & "B". Both contain a
> > module, say "M". When i run, /mvn install /in both the projects, M gets
> > installed in my local repository at two different locations, but with
> > the same name, say M-1.0.0.jar. Now, if I add the modules M as
> > dependencies to my 3rd application, say "D", in the final war of D, only
> > one M is there.
> > Is there a  way to change the name of M-1.0.0.jar of A to A-M-1.0.0.jar
> > or some similar name, without explicitly renaming the folder name of
> > module M to A-M and B-M.
> >
> > Regards,
> > Shakun
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> >
> >
> >
> >
> >
> ____________________________________________________________________________________________________
> > This electronic mail (including any attachments) may contain information
> that is privileged, confidential, and/or otherwise protected from disclosure
> to anyone other than its intended recipient(s). Any dissemination or use of
> this electronic email or its contents (including any attachments) by persons
> other than the intended recipient(s) is strictly prohibited. If you have
> received this message in error, please notify us immediately by reply email
> so that we may correct our internal records. Please then delete the original
> message (including any attachments) in its entirety. Thank you.
> >
> >
> ------------------------------------------------------------------------
> >
> >
> ---------------------------------------------------------------------
> > 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: how to manage two different projects with similar project structures

Posted by "Jeudy, Guillaume" <gj...@teksystems.com>.
Hi Shakun,
 
I think you should review your naming conventions so that any submodule can be uniquely identified within your organization projects.
 
For example in our company we use the following pattern for groupIds: <companyName>.<projectname>
 
so in your case you would have:
 
groupId:  <yourcompany>.A
artifactId:  entities
 
groupId: <yourcompany>.B
artifactIdl: entities
 
This way you will not have a namespace collision when importing your dependency in project D.
 
If you already have this setup and hit an error then maybe you need to provide more information including your mvn cmd, stacktrace + relevant pom.xml snippets.
 
Kind regards,
-Guillaume

________________________________

From: Shakun Gupta [mailto:shakun@customerxps.com]
Sent: Tue 26/08/2008 5:11 AM
To: Maven Users List
Subject: Re: how to manage two different projects with similar project structures



Hi Guillaume,

Sorry, I did not provide a bit of clarification while asking the
question. Actually, all our projects have a similar structure.
For ex : -
A (groupId)
    - entities (artifactId)
    - utilities (artifactId)
    etc..

B (groupId)
    - entities (artifactId)
    - utilities (artifactId)
    etc..

Entities in A is totally different from entities in B, so I can not
share entities. When i run /*mvn install, */entities are installed in
the .m2/respository as follows :

A (groupId)
    - entities (artifactId)
       - 1.0.0
          - entities-1.0.0.jar
    - etc..
B (groupId)
    - entities (artifactId)
       - 1.0.0
          - entities-1.0.0.jar
    - etc..

So, now if my another project D (also following the same structure),
depends on both A and B, and I deploy a web-app, then there is a
conflict between the entities-1.0.0.jar.

I can do one thing as renaming entities in A to A-entities and so on to
avoid the conflict. Is there a better way? I am not sure if the folder
name (entities) can be different from the artifactId.

Regards,
Shakun

Jeudy, Guillaume wrote:
> An artifact is uniquely identified by its groupId, artifactId, version and classifier.
> 
> In your case I hope your groupId, artifactId is different because your 'M' module really(i deduce) is a different module for 'A' & 'B' projects.
> 
> If your M module is a shared module then I suggest that either 'A' or 'B' refer to the other 'M' rather than installing it's own 'M'. You might also want to move out M module in its own project and have both A and B refer to it. You'll have to take into account the lifecycles of your projects and decide what makes the most sense to do.
> 
> -GJ
>
> ________________________________
>
> From: Shakun Gupta [mailto:shakun@customerxps.com]
> Sent: Mon 25/08/2008 6:28 AM
> To: Maven Users List
> Subject: how to manage two different projects with similar project structures
>
>
>
> Hi,
>
> I have created two different projects, say "A" & "B". Both contain a
> module, say "M". When i run, /mvn install /in both the projects, M gets
> installed in my local repository at two different locations, but with
> the same name, say M-1.0.0.jar. Now, if I add the modules M as
> dependencies to my 3rd application, say "D", in the final war of D, only
> one M is there.
> Is there a  way to change the name of M-1.0.0.jar of A to A-M-1.0.0.jar
> or some similar name, without explicitly renaming the folder name of
> module M to A-M and B-M.
>
> Regards,
> Shakun
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
>
>
>
> ____________________________________________________________________________________________________
> This electronic mail (including any attachments) may contain information that is privileged, confidential, and/or otherwise protected from disclosure to anyone other than its intended recipient(s). Any dissemination or use of this electronic email or its contents (including any attachments) by persons other than the intended recipient(s) is strictly prohibited. If you have received this message in error, please notify us immediately by reply email so that we may correct our internal records. Please then delete the original message (including any attachments) in its entirety. Thank you.
>
>  
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> 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






____________________________________________________________________________________________________
This electronic mail (including any attachments) may contain information that is privileged, confidential, and/or otherwise protected from disclosure to anyone other than its intended recipient(s). Any dissemination or use of this electronic email or its contents (including any attachments) by persons other than the intended recipient(s) is strictly prohibited. If you have received this message in error, please notify us immediately by reply email so that we may correct our internal records. Please then delete the original message (including any attachments) in its entirety. Thank you.


Re: how to manage two different projects with similar project structures

Posted by Shakun Gupta <sh...@customerxps.com>.
Hi Guillaume,

Sorry, I did not provide a bit of clarification while asking the 
question. Actually, all our projects have a similar structure.
For ex : -
A (groupId)
    - entities (artifactId)
    - utilities (artifactId)
    etc..

B (groupId)
    - entities (artifactId)
    - utilities (artifactId)
    etc..

Entities in A is totally different from entities in B, so I can not 
share entities. When i run /*mvn install, */entities are installed in 
the .m2/respository as follows :

A (groupId)
    - entities (artifactId)
       - 1.0.0
          - entities-1.0.0.jar
    - etc..
B (groupId)
    - entities (artifactId)
       - 1.0.0
          - entities-1.0.0.jar
    - etc..

So, now if my another project D (also following the same structure), 
depends on both A and B, and I deploy a web-app, then there is a 
conflict between the entities-1.0.0.jar.

I can do one thing as renaming entities in A to A-entities and so on to 
avoid the conflict. Is there a better way? I am not sure if the folder 
name (entities) can be different from the artifactId.

Regards,
Shakun

Jeudy, Guillaume wrote:
> An artifact is uniquely identified by its groupId, artifactId, version and classifier.
>  
> In your case I hope your groupId, artifactId is different because your 'M' module really(i deduce) is a different module for 'A' & 'B' projects.
>  
> If your M module is a shared module then I suggest that either 'A' or 'B' refer to the other 'M' rather than installing it's own 'M'. You might also want to move out M module in its own project and have both A and B refer to it. You'll have to take into account the lifecycles of your projects and decide what makes the most sense to do.
>  
> -GJ
>
> ________________________________
>
> From: Shakun Gupta [mailto:shakun@customerxps.com]
> Sent: Mon 25/08/2008 6:28 AM
> To: Maven Users List
> Subject: how to manage two different projects with similar project structures
>
>
>
> Hi,
>
> I have created two different projects, say "A" & "B". Both contain a
> module, say "M". When i run, /mvn install /in both the projects, M gets
> installed in my local repository at two different locations, but with
> the same name, say M-1.0.0.jar. Now, if I add the modules M as
> dependencies to my 3rd application, say "D", in the final war of D, only
> one M is there.
> Is there a  way to change the name of M-1.0.0.jar of A to A-M-1.0.0.jar
> or some similar name, without explicitly renaming the folder name of
> module M to A-M and B-M.
>
> Regards,
> Shakun
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
>
>
>
> ____________________________________________________________________________________________________
> This electronic mail (including any attachments) may contain information that is privileged, confidential, and/or otherwise protected from disclosure to anyone other than its intended recipient(s). Any dissemination or use of this electronic email or its contents (including any attachments) by persons other than the intended recipient(s) is strictly prohibited. If you have received this message in error, please notify us immediately by reply email so that we may correct our internal records. Please then delete the original message (including any attachments) in its entirety. Thank you.
>
>   
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> 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: how to manage two different projects with similar project structures

Posted by "Jeudy, Guillaume" <gj...@teksystems.com>.
An artifact is uniquely identified by its groupId, artifactId, version and classifier.
 
In your case I hope your groupId, artifactId is different because your 'M' module really(i deduce) is a different module for 'A' & 'B' projects.
 
If your M module is a shared module then I suggest that either 'A' or 'B' refer to the other 'M' rather than installing it's own 'M'. You might also want to move out M module in its own project and have both A and B refer to it. You'll have to take into account the lifecycles of your projects and decide what makes the most sense to do.
 
-GJ

________________________________

From: Shakun Gupta [mailto:shakun@customerxps.com]
Sent: Mon 25/08/2008 6:28 AM
To: Maven Users List
Subject: how to manage two different projects with similar project structures



Hi,

I have created two different projects, say "A" & "B". Both contain a
module, say "M". When i run, /mvn install /in both the projects, M gets
installed in my local repository at two different locations, but with
the same name, say M-1.0.0.jar. Now, if I add the modules M as
dependencies to my 3rd application, say "D", in the final war of D, only
one M is there.
Is there a  way to change the name of M-1.0.0.jar of A to A-M-1.0.0.jar
or some similar name, without explicitly renaming the folder name of
module M to A-M and B-M.

Regards,
Shakun

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






____________________________________________________________________________________________________
This electronic mail (including any attachments) may contain information that is privileged, confidential, and/or otherwise protected from disclosure to anyone other than its intended recipient(s). Any dissemination or use of this electronic email or its contents (including any attachments) by persons other than the intended recipient(s) is strictly prohibited. If you have received this message in error, please notify us immediately by reply email so that we may correct our internal records. Please then delete the original message (including any attachments) in its entirety. Thank you.