Search code examples
mavenrepository

Must the groupId in a maven dependency match the package of the actual jar?


There's a legacy jar in our product. The package name is from a company acquired years ago. I'm setting up maven dependencies for it, and scripts to do the local-repo install after it's built, so everything is fully automated.

When it's installed in the local repo, does the groupId have to match the actual package? E.g. if the package is com.oldcompany.oldproductname, is it OK to install it into the repo with com.newcompany.newproductname?

Would that cause real technical problems down the line? Or is groupId somewhat arbitrary, and should just be what's clearest?


Solution

  • No, there is not technical connection between the groupId and the package name.

    This is just a convention.