Unicode Maven ArtifactId [英] A Unicode Maven ArtifactId
问题描述
我刚刚尝试在Maven中创建一个项目,该项目的artifactId完全由非英语字符(日本国")组成.
I just tried creating a project in Maven whose artifactId is made up entirely of non-English characters ("日本国").
我从Maven获得以下反馈:
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.
我可以对POM文件做些什么来使Maven照原样读取artifactId吗?还是Maven在artifactId中不支持Unicode字符?
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?
推荐答案
No it doesn't support. According DefaultModelValidator class 'artifactId' and 'groupId' have to match following regular expression
ID_REGEX = "[A-Za-z0-9_\\-.]+"
如果您对maven pom文件的其他验证感兴趣,那么查阅此类源代码将很有帮助.
If you are intrested in other validations of maven pom file, looking into this class source code will be helpful.
这篇关于Unicode Maven ArtifactId的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!