How about this: "mvn" is a script that runs the JVM to run
Maven. Change the script and have it verify the artifact name length before running the JVM. If you don't want to change the mvn script, rename it and supply a new script named mvn which checked the name length and calls the renamed mvn script.
I doubt that there is any way, within Maven itself, to restrict the name length (without writing your own mojo).