Maven groupId and artifactId naming – If you are creating new project with Maven then very first thing you will have to is decide groupId, artifactId and version. Before doing this you will have to understand three attribute:
Example pom.xml
1. groupId – It uniquely identify the project among all the project so in other words it enforce naming schema. It needs to follow java package naming rule for example for any project you will give unique package name for example: com.javahonk.beaniotest, com.javahonk.csvtest
Please note maven do not enforce this rule. You will find so many legacy project that does not follow this naming convention and although use single work for groupId. If you want to include you project into maven central repository then you will have go with package unique naming otherwise single word groupId will be difficult to include.
Creating multiple subgroups are allowed and right way to determine about granularity of the groupId to use your project structure. Let’s say if you have project with multiple module then it should append new identifier to parents groupId. For example:
com.javahonk.beaniotest, com.javahonk.beaniotest.csv, com.javahonk.beaniotest,fixedlength or org.apache.maven, org.apache.maven.reporting
2.artifactId – This is name without version. It all depends on project creator what name you want to choose but be careful it should be all in lowercase and no strange symbol. Keep in mind this will be your jar name when you distribute your project
version – This also play important role in version control. When you distribute jar it goes with it and typical version comes with number for example if you created new project maven default assign version number: 1.0-SNAPSHOT (This mean its not a final version SNAPSHOT is nightly build. If you are distributing your jar then you will have to change you version like: 1.0, 1.1, 1.2… etc. Version can be increased with every final build which will be distributed.
- Maven groupId and artifactId naming for more information please refer Maven tutorial