Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A Unicode Maven ArtifactId

I just tried creating a project in Maven whose artifactId is made up entirely of non-English characters ("日本国").

I get the following feedback from Maven:

ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: com.worldevolved:日本国
POM Location: /tmp/日本国910145040748591900/pom.xml
Validation Messages:

    [0]  'artifactId' with value '日本国' does not match a valid id pattern.

Is there anything I can do to my POM file to get Maven to read the artifactId as is? Or does Maven not support Unicode characters in the artifactId?

like image 791
James Kingsbery Avatar asked Jan 21 '10 18:01

James Kingsbery


People also ask

What does artifactId mean in Maven?

artifactId is the name of the jar without version. If you created it, then you can choose whatever name you want with lowercase letters and no strange symbols. If it's a third party jar, you have to take the name of the jar as it's distributed. eg. maven , commons-math.

What should be the groupId and artifactId in Maven?

groupId – a unique base name of the company or group that created the project. artifactId – a unique name of the project. version – a version of the project.

What is difference between groupId and artifactId in Maven?

The main difference between groupId and artifactId in Maven is that the groupId specifies the id of the project group while the artifactId specifies the id of the project.


1 Answers

No it doesn't support. According DefaultModelValidator class 'artifactId' and 'groupId' have to match following regular expression

ID_REGEX = "[A-Za-z0-9_\\-.]+"

If you are intrested in other validations of maven pom file, looking into this class source code will be helpful.

like image 197
cetnar Avatar answered Sep 20 '22 18:09

cetnar