Java Package Naming

Ok, so I need tips on how to choose a name for my Java packages.

I saw this post: What package naming convention do you use for personal / hobby projects in Java? but it speaks of personal projects.

What if, for example, I wanted to create an API wrapper and I am developing with others on GitHub? I do not have a domain name.

+4
source share
2 answers

A back-domain domain agreement to prevent name collisions. Two different companies with the same product name will have different namespaces, so everything will be fine.

If you do not have a domain, you need to choose a name that matters to you and will not run into anything else. This is normal; it just means that you need a little more work to make sure that there is no existing product with the name you want, and it may be difficult if there will ever be a name clash.

You won’t be the first to do this: The JMockit library is in the namespace "mockit" without "com" or the prefix "org".

+6
source

The recommendation has always been to start with your domain name back and then the name of the project, for example. com.mycompany.myproject, and continue with submodules if necessary.

+2
source

All Articles