Apache Maven – Co-ordinates explained

In this article, we will understand about maven co-ordinates

Q) What is Maven Co-ordinates ?

  • <groupId>:<artifactId>:<version> defines a maven co-ordinate for any maven module in local or central or remote repositories
  • This combination needs to be unique, to distinctly identify maven artifacts from other artifacts in any of the repositories (local/central/remote)
  • For example, maven co-ordinate for spring-core module is
    • groupId –> org.springframework
    • artifactId –> spring-core
    • version –> 4.1.3.RELEASE
  • Above co-ordinate added as <dependency> under <dependencies> tag in pom.xml as below
<dependency>
	<groupId>org.springframework</groupId>
	<artifactId>spring-core</artifactId>
	<version>4.1.3.RELEASE</version>
</dependency>

Now, there won’t be any other maven module with same co-ordinates other than this

Q) How can we search Maven co-ordinates ?

  • Initially users/developers who are all just started to understand and getting hold of maven will find it difficult to search maven co-ordinates for their project requirements
  • In fact, it takes time to understand exactly which maven co-ordinate should we use for our project requirements
  • But with experience, everything gets sorted out and makes developers life easy –> that’s beauty of the maven

To search Maven co-ordinate:

  • There are various website from where we can look upon to get the required co-ordinates for our requirements
  • Central repository: http://search.maven.org/
    • This website is developed and maintained by ‘Apache Software Foundation‘ and it’s contributed by many Maven users
  • Maven repository: http://mvnrepository.com/
    • This is another one to find Maven co-ordinate
  • And there are various third party sites to host their specific modules i.e.; Remote repositories
  • Still un-successful: Call the help of Google

Useful Eclipse IDE shortcuts :

Related Articles:

References:

Happy Coding !!
Happy Learning !!

Apache Maven - offline execution
Apache Maven - Exclusions and Inclusions of unit test