Show TOC

Maven Project StructureLocate this document in the navigation structure

When you create a Maven project, the directory structure that is created includes the project object model (POM) file.

In this sample project, the <groupId> is set to com.sap.example. This directory structure is created automatically for a new project:


Maven Project Directory Structure

Two Java files, App.java and AppTest.java, are created in the example folders, under main and test, respectively. The POM file, which contains the initial project configuration, is created in the customState folder. You can use this POM file as a starting point for custom-state development.
<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>com.sap.example</groupId>    
  <artifactId>customState</artifactId>    
  <version>1.0-SNAPSHOT</version>    
  <packaging>jar</packaging>        
     
  <name>customState</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> 

You can open or import a newly created Maven project into your IDE. Eclipse and NetBeans both support Maven. The image below shows the sample project structure in Eclipse.


Maven Project in Eclipse

Once you are familiar with the structure and the content of POM files, you can create them manually. You can also create a new project in any IDE that supports Maven.