It would be much better to use a prefix (e.g. graal-) on all jar file identifiers when they are sent to Maven Central. The worst offenders at the moment are compiler-<version>.jar and regex-<version>,jar which have a high probability of collision with other libraries.
They only have to be unique within their Group ID, don't they? Wouldn't a graal- prefix be redundant?
Just think what happens to the classpath if there鈥檚 no prefix and another library comes along with a compiler or a regex implementation.
I think Maven uses fully qualified class paths. Here's an example from a Maven project I just tried.
-cp /Users/chrisseaton/.m2/repository/org/apache/struts/struts2-core/2.5.12/struts2-core-2.5.12.jar:/Users/chrisseaton/.m2/repository/org/freemarker/freemarker/2.3.23/freemarker-2.3.23.jar:/Users/chrisseaton/.m2/repository/ognl/ognl/3.1.12/ognl-3.1.12.jar:/Users/chrisseaton/.m2/repository/org/javassist/javassist/3.20.0-GA/javassist-3.20.0-GA.jar:/Users/chrisseaton/.m2/repository/org/apache/logging/log4j/log4j-api/2.8.2/log4j-api-2.8.2.jar ...
So there should still not be any conflict.
Yes, but when you package an app for running independent of the build system, there can be a conflict. Or you could see it as just a courtesy for users - they can look at their class path or their IDE and see immediately that graal is there, not some other random regex library. It's not a really big deal, to be sure, but it's easy to do, and most Java libraries stick to the convention (some to be sure do not, but that doesn't mean anyone should copy them).
Ok I'll leave this open for more opinions.
I also don't see why having unique <groupID>:<artifactID> shouldn't be good enough. If some form of packaging cannot handle when <artifactID>s alone are not unique that is a problem of that particular packaging infrastructure and it's not a good idea to adjust our artifactIDs to compensate for that.
I don't think any library should be dictating packaging formats. It's pretty standard across all kinds of packaging technology to put jar files together in one directory (e.g. see the WAR file format used in JEE). If artifact ids clash it creates problems. The courtesy angle is unrelated as well, and IMO is enough to justify a change of artifact id.
I think @olpaw has a valid point. If one wants to deploy jars obtained via maven differently, then you are effectively re-packaging them. During the repackaging and moving of jars, a prefix can be added to the file name.
Seriously? So you think it would be better to go and change all the packaging tools in the universe that build jars and wars, rather than just rename a jar file in one project? Those tools already exist, and they don't generally apply prefixes to jar names.
@dsyer is this a problem in practice? Is there something that we can't do with our jars now because of the way they're named? I can understand the theoretical problem if someone chooses to throw away the group ID, but is it also an immediate practical problem?
Maven's guide isn't very long, but it seems to imply that the artefact name doesn't need to have the group name in as well, so we aren't dictating a packaging format - we're following the existing standard one.
https://maven.apache.org/guides/mini/guide-naming-conventions.html
No, it's not a problem in practice for me at the minute (I'm not sure I will ever build an app with these jars), so I guess I'm throwing in the towel. I'm kind of surprised you would be opposed to a simple change like this that could make people's life easier later, but it's your choice in the end.
Thanks for taking the time to send us your thoughts and to talk it through though, we appreciate it.
@dsyer sorry, I'm not trying to squash this proposal but as Chris is saying (better than I have so far!), I just want to understand why this is not a problem that can be solved by packaging tools. I'm not very familiar with the latter but was imaging they must already have support for jars coming from Maven repos that follow the Maven naming conventions. If that's not the case, then your suggestion makes sense. Maybe you could point to some of the packaging tools that build war files where the unqualified jar names are a problem.
Maven uses, for example, its own https://maven.apache.org/plugins/maven-war-plugin/usage.html to create WAR files. It doesn't do any prefixing of jar file artifacts by default. I'm not aware that it even does so as an option (never saw anyone try, but I have seen apps that don't work because of jar name clashes).
Most helpful comment
They only have to be unique within their Group ID, don't they? Wouldn't a
graal-prefix be redundant?