Make delicious recipes!

Project coordinates


If you look at our simple pom.xml file, lines 5-8 describe what is known as the co-ordinates of a maven project.

groupId identifies the group to which several related projects belong.
It is usually the reverse-URL of the company.
artifactId uniquely identifies a project in a group.
version refers to a particular version of a project.

These 3 together uniquely identify a project and are known as the co-ordinates of a project.
Maven uses these coordinates to keep cahced/downloaded copies of the compiled projects in ~/.m2 directory
For example, you can see cached libraries for our simple project (specified by the below pom.xml) at ~/.m2/repository/org/companyname/simple/simple/1.0-SNAPSHOT/
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.companyname.simple</groupId>
  <artifactId>simple</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>simple</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>


The above coordinates stragey is used for all maven projects.
For example, checkout the ~/.m2 directory for maven plugins:
find ~/.m2/repository/org/apache/maven/plugins -name \*.jar

~/.m2/repository/org/apache/maven/plugins/maven-antrun-plugin/1.3/maven-antrun-plugin-1.3.jar
~/.m2/repository/org/apache/maven/plugins/maven-archetype-plugin/2.2/maven-archetype-plugin-2.2.jar
~/.m2/repository/org/apache/maven/plugins/maven-assembly-plugin/2.2-beta-5/maven-assembly-plugin-2.2-beta-5.jar
~/.m2/repository/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.jar
~/.m2/repository/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.jar
~/.m2/repository/org/apache/maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler-plugin-2.3.2.jar
.
.
.
~/.m2/repository/org/apache/maven/plugins/maven-site-plugin/3.0/maven-site-plugin-3.0.jar
~/.m2/repository/org/apache/maven/plugins/maven-site-plugin/3.3/maven-site-plugin-3.3.jar
~/.m2/repository/org/apache/maven/plugins/maven-surefire-plugin/2.10/maven-surefire-plugin-2.10.jar
~/.m2/repository/org/apache/maven/plugins/maven-surefire-plugin/2.12.4/maven-surefire-plugin-2.12.4.jar
~/.m2/repository/org/apache/maven/plugins/maven-war-plugin/2.1.1/maven-war-plugin-2.1.1.jar

mvn install copies the jars/wars for the current project into ~/.m2 directory.
This way it becomes available to other projects who have a dependency on this project.






Like us on Facebook to remain in touch
with the latest in technology and tutorials!


Got a thought to share or found a
bug in the code?
We'd love to hear from you:

Name:
Email: (Your email is not shared with anybody)
Comment:

Facebook comments:

Site Owner: Sachin Goyal