A Unicode Maven ArtifactId

馋奶兔 提交于 2019-12-06 17:27:35

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/2111704/a-unicode-maven-artifactid

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!