Which package name should I use for open source java library? [closed]
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this questionI'd like to release an open source java library. I thought of using my last name as packag开发者_高级运维e name but I find that a bit weird. I'd like to use something more neutral like 'open.libname'.
Are there any recommendations on open source java package naming?
As the others said, start the package name with the reversed domain name:
Register a domain such as myproject.org and then use org.myproject.mymodule
.
Or, if you don't have your own domain use the sub-domain where you host the code, e.g. if you host the code on myproject.sourceforge.net, use net.sourceforge.myproject.mymodule
.
The usual recommendation is to prefix your package with the name of a domain you own in reverse order: com.mydomain.mypackage
. Since you own the domain, the chances of name collisions are reduced.
Also, a better choice for the package name is something that reflects the functionality of the package, rather than your own name. What will you use when you want to release your second (and perhaps totally unrelated) library?
Where are you hosting your project? When I host a project on Google Code, for example, I tend to use com.googlecode.project-name
(it seems rude to use com.google.code.project-name
). I don't actually know what Google thinks about this, but it follows the example of many Sourceforge.net projects. If you have a personal/corporate domain then go ahead and use that one, of course.
This may or may not be the answer you're looking for.
The common convention is to reverse your personal/company domain name and prepend it to whatever the name of the package is.
So, if your domain is "www.feel.com" and your package name is "mypackage", then your fully qualified package name would be: com.feel.mypackage
精彩评论