You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Andrew Hughes <ah...@gmail.com> on 2009/03/31 06:26:01 UTC

Duplicate Module/Project Names in m2eclipse

Hi,
Eclipse can't seem to handle two modules in the same workspace that have the
same artifactId. For example if I have a multi-module
project (groupId:artifact) as below:

   - carworld:carworld
      - carworld:ferrari
      - carworld.ferrari:car
         - carworld:porsche
      - carworld.porsche:car

There are two modules that have <artifactId>car</artifactId> (but different
groupId's). m2Eclipse+Eclipse appears to use the artifactId as the project
identifier and when the two "car" projects are imported only one is actually
imported.

Is this a known issue? are there any workarounds?

Cheers.

Re: Duplicate Module/Project Names in m2eclipse

Posted by Kalle Korhonen <ka...@gmail.com>.
Thanks, good to know. All the more reason to switch from q4e to m2e once the
incremental compiler becomes available!

Kalle


On Tue, Mar 31, 2009 at 11:03 AM, Brian E. Fox <br...@reply.infinity.nu>wrote:

> When you import, you can select a naming template and one of them
> includes the group. This is also handy if you happen to have multiple
> branches imported at the same time, since one of the other options
> includes the version.
>
> -----Original Message-----
> From: Andrew Hughes [mailto:ahhughes@gmail.com]
> Sent: Tuesday, March 31, 2009 12:26 AM
> To: Maven Users List
> Subject: Duplicate Module/Project Names in m2eclipse
>
> Hi,
> Eclipse can't seem to handle two modules in the same workspace that have
> the
> same artifactId. For example if I have a multi-module
> project (groupId:artifact) as below:
>
>   - carworld:carworld
>      - carworld:ferrari
>      - carworld.ferrari:car
>         - carworld:porsche
>      - carworld.porsche:car
>
> There are two modules that have <artifactId>car</artifactId> (but
> different
> groupId's). m2Eclipse+Eclipse appears to use the artifactId as the
> project
> identifier and when the two "car" projects are imported only one is
> actually
> imported.
>
> Is this a known issue? are there any workarounds?
>
> Cheers.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

RE: Duplicate Module/Project Names in m2eclipse

Posted by "Brian E. Fox" <br...@reply.infinity.nu>.
When you import, you can select a naming template and one of them
includes the group. This is also handy if you happen to have multiple
branches imported at the same time, since one of the other options
includes the version.

-----Original Message-----
From: Andrew Hughes [mailto:ahhughes@gmail.com] 
Sent: Tuesday, March 31, 2009 12:26 AM
To: Maven Users List
Subject: Duplicate Module/Project Names in m2eclipse

Hi,
Eclipse can't seem to handle two modules in the same workspace that have
the
same artifactId. For example if I have a multi-module
project (groupId:artifact) as below:

   - carworld:carworld
      - carworld:ferrari
      - carworld.ferrari:car
         - carworld:porsche
      - carworld.porsche:car

There are two modules that have <artifactId>car</artifactId> (but
different
groupId's). m2Eclipse+Eclipse appears to use the artifactId as the
project
identifier and when the two "car" projects are imported only one is
actually
imported.

Is this a known issue? are there any workarounds?

Cheers.

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


RE: Duplicate Module/Project Names in m2eclipse

Posted by Todd Thiessen <th...@nortel.com>.
I think m2e does allow you to create a project with the groupId as part
of the project name. If you open the "Advanded" dialog during an import
you will see a name template.

---
Todd Thiessen
 

> -----Original Message-----
> From: Kalle Korhonen [mailto:kalle.o.korhonen@gmail.com] 
> Sent: Tuesday, March 31, 2009 1:55 PM
> To: Maven Users List
> Subject: Re: Duplicate Module/Project Names in m2eclipse
> 
> On Tue, Mar 31, 2009 at 6:56 AM, Jason van Zyl 
> <jv...@sonatype.com> wrote:
> 
> > Give your projects different names.
> > We're not going to support duplicate artifactIds in the 
> reactor. You 
> > can't have two artifacts with the same coordinate and 
> expect it to work.
> > Name your projects properly.
> >
> 
> That's a very narrow-minded view. While best practice 
> suggests to have some project identifier as part of the 
> artifact id (e.g. tapestry-ioc,
> maven-compiler-plugin) it's quite possible that two 
> completely separate projects would arrive at the same 
> artifact id. The point of group id and version together with 
> the artifactid is to uniquely identify the artifact, is it 
> not? So using just the artifact id in Eclipse to 
> differentiate between the project is a limitation. It's not 
> just a problem with just weakly named artifacts - for example 
> try working on multiple branches at the same time and 
> importing them to the same workspace (I often rename the 
> projects in Eclipse first; you could try that Andrew). If 
> m2eclipse would just use <groupId>:<artifactId>:<version> as 
> the Eclipse project name what difference would it make? I 
> mean, Jason what's the reason to oppose it so strongly?
> 
> Hopefully nestable projects in Eclipse would solve this 
> properly somewhere around 4.x.
> 
> Kalle
> 

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


Re: Duplicate Module/Project Names in m2eclipse

Posted by Jason van Zyl <jv...@sonatype.com>.
On 31-Mar-09, at 10:54 AM, Kalle Korhonen wrote:

> On Tue, Mar 31, 2009 at 6:56 AM, Jason van Zyl  
> <jv...@sonatype.com> wrote:
>
>> Give your projects different names.
>> We're not going to support duplicate artifactIds in the reactor.  
>> You can't
>> have two artifacts with the same coordinate and expect it to work.
>> Name your projects properly.
>>
>
> That's a very narrow-minded view.

You need a unique coordinate. The system breakdowns pretty fast if you  
don't have that.

Should we adjust the internals of Maven to deal with something that is  
easily rectified in an individual project.

> While best practice suggests to have some
> project identifier as part of the artifact id (e.g. tapestry-ioc,
> maven-compiler-plugin) it's quite possible that two completely  
> separate
> projects would arrive at the same artifact id.

It appeared from his example it was in the same reactor, and therefore  
I assumed the same coordinate.

As long as there is a unique coordinate Maven is fine. Aside from that  
having the exact same artifactId also just leads to problems. Try  
putting them in the same assembly, try to visually identify which one  
is which in different directories. For the possible aggravation I opt  
for what will cause the least amount of hassle.

> The point of group id and
> version together with the artifactid is to uniquely identify the  
> artifact,
> is it not? So using just the artifact id in Eclipse to differentiate  
> between
> the project is a limitation. It's not just a problem with just  
> weakly named
> artifacts - for example try working on multiple branches at the same  
> time
> and importing them to the same workspace (I often rename the  
> projects in
> Eclipse first; you could try that Andrew). If m2eclipse would just use
> <groupId>:<artifactId>:<version> as the Eclipse project name what  
> difference
> would it make? I mean, Jason what's the reason to oppose it so  
> strongly?
>
> Hopefully nestable projects in Eclipse would solve this properly  
> somewhere
> around 4.x.
>
> Kalle

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
----------------------------------------------------------

Three may keep a secret if two of them are dead.

  -- Benjamin Franklin


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


Re: Duplicate Module/Project Names in m2eclipse

Posted by Kalle Korhonen <ka...@gmail.com>.
On Tue, Mar 31, 2009 at 6:56 AM, Jason van Zyl <jv...@sonatype.com> wrote:

> Give your projects different names.
> We're not going to support duplicate artifactIds in the reactor. You can't
> have two artifacts with the same coordinate and expect it to work.
> Name your projects properly.
>

That's a very narrow-minded view. While best practice suggests to have some
project identifier as part of the artifact id (e.g. tapestry-ioc,
maven-compiler-plugin) it's quite possible that two completely separate
projects would arrive at the same artifact id. The point of group id and
version together with the artifactid is to uniquely identify the artifact,
is it not? So using just the artifact id in Eclipse to differentiate between
the project is a limitation. It's not just a problem with just weakly named
artifacts - for example try working on multiple branches at the same time
and importing them to the same workspace (I often rename the projects in
Eclipse first; you could try that Andrew). If m2eclipse would just use
<groupId>:<artifactId>:<version> as the Eclipse project name what difference
would it make? I mean, Jason what's the reason to oppose it so strongly?

Hopefully nestable projects in Eclipse would solve this properly somewhere
around 4.x.

Kalle

Re: Duplicate Module/Project Names in m2eclipse

Posted by Tobias Gierke <to...@code-sourcery.de>.
Hi,
>>>
>>> Give your projects different names.
>>>
>>> We're not going to support duplicate artifactIds in the reactor. You 
>>> can't have two artifacts with the same coordinate and expect it to 
>>> work.
>>>
>>> Name your projects properly.
>> I always thought Maven artifacts are uniquely identified by { groupId 
>> , artifactId , version } - how come two artifacts with same artifact 
>> IDs but *different* group IDs have "the same coordinate" ?
>>
>
> The GAV is the coordinate. Beyond that the only rule I generally have 
> is that an artifact can land in a directory (assembly) which 
> everything else and not get clobbered, and that you can easily 
> identify what you are looking at. Having N car-1.0.jar artifacts does 
> not appear to be something I would want in a system I was trying to 
> maintain. Be unique at all levels == less aggravating over time.
You're right, I didn't think about the deployment issues.

Regards,

Tobias
>
>> @op: At work we're using some Perl script magic along with the 
>> maven-eclipse-plugin to automatically generate/update .classpath 
>> /.project files. The plugin has a <addGroupIdToProjectName>/ option
>> that might solve your problem (haven't tried it myself but I'm afraid 
>> you would have to disable m2eclipse for the project to make this 
>> work). Changing one of the conflicting projects to use a different 
>> artifactId might be way easier (assuming you don't have released 
>> these artifacts to the "public" / clients).
>>
>> Regards,
>>
>> Tobias
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>
> Thanks,
>
> Jason
>
> ----------------------------------------------------------
> Jason van Zyl
> Founder,  Apache Maven
> http://twitter.com/jvanzyl
> ----------------------------------------------------------
>
> To do two things at once is to do neither.
>
>  -—Publilius Syrus, Roman slave, first century B.C.
>
>
> ---------------------------------------------------------------------
> 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: Duplicate Module/Project Names in m2eclipse

Posted by Bryan Loofbourrow <br...@amdocs.com>.
On 31-Mar-09, at 11:40 AM, Jason Van Zyn wrote:

>> As long as there is a unique coordinate Maven is fine. Aside from
that 
>> having the exact same artifactId also just leads to problems. Try
putting 
>> them in the same assembly, try to visually identify which one is
which in 
>> different directories. For the possible aggravation I opt for what
will 
>> cause the least amount of hassle.

Ok, I see that -- the fact that groupIds are not included in the
artifact file naming pattern means that they cannot serve as a namespace
for artifactIds, in the sense of being sufficient to establish
uniqueness. 

That leaves two issues:

(1) The need for globally unique artifactIds for things that might end
up in the same project. Without the "com.mycompany" sort of convention,
that's hard to do. If I'm including two third party artifacts that
happen to share an artifactId, it sounds as though I'm in some trouble.

(2) Is Maven consistent about artifactId (plus version) as a unique
identifier? Is that documented somewhere? Will I get errors if I try to
assemble a war or ear from artifacts that have different groupIds, but
the same artifactId, regardless of whether the versions match?

-- Bryan



This message and the information contained herein is proprietary and confidential and subject to the Amdocs policy statement,
you may review at http://www.amdocs.com/email_disclaimer.asp

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


Re: Duplicate Module/Project Names in m2eclipse

Posted by Jason van Zyl <jv...@sonatype.com>.
On 31-Mar-09, at 11:40 AM, Tobias Gierke wrote:

> Hi,
>> Hi,
>>> Eclipse can't seem to handle two modules in the same workspace  
>>> that have the
>>> same artifactId. For example if I have a multi-module
>>> project (groupId:artifact) as below:
>>>
>>>  - carworld:carworld
>>>     - carworld:ferrari
>>>     - carworld.ferrari:car
>>>        - carworld:porsche
>>>     - carworld.porsche:car
>>>
>>> There are two modules that have <artifactId>car</artifactId> (but  
>>> different
>>> groupId's). m2Eclipse+Eclipse appears to use the artifactId as the  
>>> project
>>> identifier and when the two "car" projects are imported only one  
>>> is actually
>>> imported.
>>>
>>> Is this a known issue? are there any workarounds?
>>>
>>
>> Give your projects different names.
>>
>> We're not going to support duplicate artifactIds in the reactor.  
>> You can't have two artifacts with the same coordinate and expect it  
>> to work.
>>
>> Name your projects properly.
> I always thought Maven artifacts are uniquely identified by  
> { groupId , artifactId , version } - how come two artifacts with  
> same artifact IDs but *different* group IDs have "the same  
> coordinate" ?
>

The GAV is the coordinate. Beyond that the only rule I generally have  
is that an artifact can land in a directory (assembly) which  
everything else and not get clobbered, and that you can easily  
identify what you are looking at. Having N car-1.0.jar artifacts does  
not appear to be something I would want in a system I was trying to  
maintain. Be unique at all levels == less aggravating over time.

> @op: At work we're using some Perl script magic along with the maven- 
> eclipse-plugin to automatically generate/update .classpath /.project  
> files. The plugin has a <addGroupIdToProjectName>/ option
> that might solve your problem (haven't tried it myself but I'm  
> afraid you would have to disable m2eclipse for the project to make  
> this work). Changing one of the conflicting projects to use a  
> different artifactId might be way easier (assuming you don't have  
> released these artifacts to the "public" / clients).
>
> Regards,
>
> Tobias
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
----------------------------------------------------------

To do two things at once is to do neither.

  -—Publilius Syrus, Roman slave, first century B.C.


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


Re: Duplicate Module/Project Names in m2eclipse

Posted by Tobias Gierke <to...@code-sourcery.de>.
Hi,
> Hi,
>> Eclipse can't seem to handle two modules in the same workspace that 
>> have the
>> same artifactId. For example if I have a multi-module
>> project (groupId:artifact) as below:
>>
>>   - carworld:carworld
>>      - carworld:ferrari
>>      - carworld.ferrari:car
>>         - carworld:porsche
>>      - carworld.porsche:car
>>
>> There are two modules that have <artifactId>car</artifactId> (but 
>> different
>> groupId's). m2Eclipse+Eclipse appears to use the artifactId as the 
>> project
>> identifier and when the two "car" projects are imported only one is 
>> actually
>> imported.
>>
>> Is this a known issue? are there any workarounds?
>>
>
> Give your projects different names.
>
> We're not going to support duplicate artifactIds in the reactor. You 
> can't have two artifacts with the same coordinate and expect it to work.
>
> Name your projects properly.
I always thought Maven artifacts are uniquely identified by { groupId , 
artifactId , version } - how come two artifacts with same artifact IDs 
but *different* group IDs have "the same coordinate" ?

@op: At work we're using some Perl script magic along with the 
maven-eclipse-plugin to automatically generate/update .classpath 
/.project files. The plugin has a <addGroupIdToProjectName>/ option
that might solve your problem (haven't tried it myself but I'm afraid 
you would have to disable m2eclipse for the project to make this work). 
Changing one of the conflicting projects to use a different artifactId 
might be way easier (assuming you don't have released these artifacts to 
the "public" / clients).

Regards,

Tobias

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


Re: Duplicate Module/Project Names in m2eclipse

Posted by Jason van Zyl <jv...@sonatype.com>.
On 30-Mar-09, at 9:26 PM, Andrew Hughes wrote:

> Hi,
> Eclipse can't seem to handle two modules in the same workspace that  
> have the
> same artifactId. For example if I have a multi-module
> project (groupId:artifact) as below:
>
>   - carworld:carworld
>      - carworld:ferrari
>      - carworld.ferrari:car
>         - carworld:porsche
>      - carworld.porsche:car
>
> There are two modules that have <artifactId>car</artifactId> (but  
> different
> groupId's). m2Eclipse+Eclipse appears to use the artifactId as the  
> project
> identifier and when the two "car" projects are imported only one is  
> actually
> imported.
>
> Is this a known issue? are there any workarounds?
>

Give your projects different names.

We're not going to support duplicate artifactIds in the reactor. You  
can't have two artifacts with the same coordinate and expect it to work.

Name your projects properly.

> Cheers.

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
----------------------------------------------------------

believe nothing, no matter where you read it,
or who has said it,
not even if i have said it,
unless it agrees with your own reason
and your own common sense.

  -- Buddha


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