Creating a maven project - Hima Inc

12
1 www.himainc.com Creating a maven project

Transcript of Creating a maven project - Hima Inc

Page 1: Creating a maven project - Hima Inc

1

www.himainc.com

Creating a maven project

Page 2: Creating a maven project - Hima Inc

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

Page 3: Creating a maven project - Hima Inc

3

www.himainc.com

Requirements:

Eclipse IDE

Java SDK

Apache Maven

M2E

Page 4: Creating a maven project - Hima Inc

4

www.himainc.com

Creating maven project:

Page 5: Creating a maven project - Hima Inc

5

www.himainc.com

Page 6: Creating a maven project - Hima Inc

6

www.himainc.com

Page 7: Creating a maven project - Hima Inc

7

www.himainc.com

Page 8: Creating a maven project - Hima Inc

8

www.himainc.com

Maven Project Structure:

Java project to maven project:

Create a new Java Project in Eclipse or open an existing project

Page 9: Creating a maven project - Hima Inc

9

www.himainc.com

Page 10: Creating a maven project - Hima Inc

10

www.himainc.com

Page 11: Creating a maven project - Hima Inc

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>

Page 12: Creating a maven project - Hima Inc

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>