1

I am not able to create a maven web-app project in eclipse. It is giving me an error when I am creating the group ID

" Invalid group id: 'org.' is an invalid name on this platform."

When i type org it is fine but when i append "org." I get this error --" Invalid group id: 'org.' is an invalid name on this platform."

Why is this happening?

screenshot

ram kumar
  • 13
  • 7

1 Answers1

0

Theoretically if you will look at the maven xsd https://maven.apache.org/xsd/maven-4.0.0.xsd it does not apply any restriction on the group id, just ask for string.

Internally it will validate using the regex "[A-Za-z0-9_\-.]+" see here thanks tunaki

<xs:element minOccurs="0" name="groupId" type="xs:string">
<xs:annotation>
<xs:documentation source="version">3.0.0+</xs:documentation>
<xs:documentation source="description">
A universally unique identifier for a project. It is normal to use a fully-qualified package name to distinguish it from other projects with a similar name (eg. <code>org.apache.maven</code>).
</xs:documentation>
</xs:annotation>
</xs:element>

But the description specify that (and the common use case) to usea fully-qualified package name witch should not end with "."
But remember that maven use the group id to create the directory path where it store the artifact locally. Maybe some OS found it problematic so m2eclipse prefer to avoid it.

In windows 7.0 if you will try to compile such project from command line it will work fine.

Anyway I think that it is recommenced to avoid the "." in the end of the groupid

Community
  • 1
  • 1
Haim Raman
  • 11,508
  • 6
  • 44
  • 70
  • The groupId is validated by a regex, although it doesn't appear in the XSD, see http://stackoverflow.com/a/35631066/1743880. Looks like that regex would accept `groupId` ending with `.`. – Tunaki Sep 11 '16 at 10:43
  • As I said it will work for maven but not for m2eclipse. Maybe my spelling mistake was confusing avid = avoid – Haim Raman Sep 11 '16 at 11:14
  • Yes, I was just commenting on what you said for "*does not apply any restriction on the group id*". There is indeed a check. It just turns out that ending the `groupId` with a `.` is accepted by Maven. – Tunaki Sep 11 '16 at 11:16