1
www.himainc.com
Creating a maven project
2
www.himainc.com
Table of Contents
Requirements………………………………………………………………………………………………………………………………………..3
Creating a maven project in Eclipse………………………………………………………………………………………………………..4
Converting Java Project to maven Project………………………………………………………………………………………………8
Adding an external jar library in maven project…………………………………………………………………………………….11
Adding an external sources library in maven project……………………………………………………………………………12
3
www.himainc.com
Requirements:
Eclipse IDE
Java SDK
Apache Maven
M2E
4
www.himainc.com
Creating maven project:
5
www.himainc.com
6
www.himainc.com
7
www.himainc.com
8
www.himainc.com
Maven Project Structure:
Java project to maven project:
Create a new Java Project in Eclipse or open an existing project
9
www.himainc.com
10
www.himainc.com
11
www.himainc.com
Adding an external jar library into maven:
Open pom.xml from the project and add the following content at the end of the project before </project>
<dependencies>
<dependency>
<groupId>test</groupId>
<artifactId>test1</artifactId>
<version>1</version>
<scope>system</scope>
<systemPath><path to the .jar file> </systemPath>
</dependency>
</dependencies>
12
www.himainc.com
Adding external sources in maven project:
In pom.xml file change <sourceDirectory>src/main/java</sourceDirectory>
To
<sourceDirectory>absolute path to your source directory </sourceDirectory>