Tuesday, 17 May 2016

What are the element defined in pom.xml ?


pom.xml elements

  • project : Root element
    • modelVersion : Set to 4.0.0
    • groupId : ID for project group
    • artifactId : Project / Artifact Id
    • version : Project version under given group
    • packaging : Packaging type - jar / war / ...
    • name : Name of maven project
    • url : Project URL
    • dependencies : Dependencies of the project
      • dependency : A dependency under dependencies element
        • groupId, artifactId, version
        • scope : Scope of Maven project :
                       compiled / provided / runtime / system / test


Example
<project ...>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.shaan.project</groupId>
  <artifactId>myapp</artifactId>
  <version>1.0</version>

  <packaging>jar</packaging>
  <name>My sample App</name>
  <url>http://maven.apache.org</url>

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

No comments:

Post a Comment

Note: only a member of this blog may post a comment.