How To Create Maven Project in Eclipse Without Archetype

Getting started with Apache Maven in Eclipse

Maven is a very popular build and dependency management tool. Eclipse is an IDE that helps developers write and run Java code easily. In this article, I will be explaining how you can create a Maven project in Eclipse.

Maven Basics

Maven automates the steps involved in building a software application like adding the JAR files, compiling code, running unit tests, creating the output jar/war file, etc. This makes the code less error-prone. Maven uses an XML configuration file known as the POM file. Developers need to specify information like the JAR files required by an application, the type of output artifact (jar,war, etc). Maven then uses the instructions in the POM file to build the application.

Eclipse Maven Integration

Most of the recent Eclipse releases already include Maven. So, developers do not need to do anything special to install Maven in Eclipse.  However, some earlier versions of Eclipse do not include Maven, so it needs to be installed explicitly from the Eclipse marketplace. Once Maven is set up with Eclipse, it allows you to easily create a Maven project and use all the Maven features like dependency resolution within Eclipse itself.

Creating a Simple Maven Project

In order to create a simple Maven project in Eclipse, the following steps need to be followed:

1
Create new artefact of type ‘Other’

blank

From menu File > New select ‘Other’

2
Select Maven Project. Click Next

blank

On the ‘new project’ wizard select ‘Maven Project’

3
Select ‘Create a Simple Project’

blank

Click the Create a Simple Project (skip archetype selection) checkbox. Click Next

4
Enter value for Group Id & Artifact Id.

blank

5
Change version and packaging

blank

Change version and packaging if required (This is an optional step). Click Finish

6
New Maven Project Created

blank

This creates a Maven project in Eclipse with the Maven directory structure and POM file as follows

7
View Your POM File

blank

The default POM created has the group id, artifact id, version and packaging specified at the time of creation as follows

8
Finish!

This POM file can then be modified by adding dependencies and other information as required.


Tushar Sharma
Tushar Sharmahttps://www.automationdojos.com
Hi! This is Tushar, the author of 'Automation Dojos'. A passionate IT professional with a big appetite for learning, I enjoy technical content creation and curation. Hope you are having a good time! Don't forget to subscribe and stay in touch. Wishing you happy learning!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

RELATED POSTS

Remove Duplicates from List Using LinkedHashSet

Another implementation of the Set interface is LinkedHashSet. LinkedHashSet maintains the order of elements and helps to overcome the HashSet limitation. The following code...

Java Tutorial #6 โ€“ Jump Statements

Introduction The break statement is used to stop further execution. It can be used either in a loop or within a switch statement. Break Statement The break...

Create Basic Hibernate Program

Hibernate is an ORM framework that helps in accessing database tables from Java code. It is an object-oriented way of accessing database tables and...

Java Tutorial #7 Part 1 โ€“ Classes & Objects

Classes are a very important concept in Java. Java code always needs to be written in a class. In this article, we will be...

ร‚

RECENT 'HOW-TO'

How To Install Oh-My-Posh On Windows PowerShell

Oh-My-Posh is a powerful custom prompt engine for any shell that has the ability to adjust the prompt string with a function or variable. It does not...

MORE ON CODEX

FEATURED PROJECTS

SEPA Bulk File Generator and Validator

ADjo LABS PROJECT: SEPA Bulk File Generator and Validator. Supported File Types PAIN008, PAIN001, PACS003 and PACS008. Tested for supporting PAIN.008.001.001 and PAIN.008.001.002 (version 1&2). The XML...

MORE IN THIS CATEGORY

How To Convert String To Date in Java

Introduction There are often scenarios in programming, where you will need to convert a date in String format to an actual Date object. For example,...

Concatenate Strings Using StringBuilder.append()

In addition to String, Java has the java.lang.StringBuffer and java.lang.StringBuilder classes. These can also be used to concatenate Strings. The advantage of these...

Remove Duplicates from List Using HashSet

The Set is also an interface in the 'Java Collection' framework. Unlike a List, a Set does not allow duplicates. Hence you can...

Concatenate Strings Using String Joiner

Java 8 has added a new class called StringJoiner. This concatenates Strings using a delimiter as well as adds a prefix and suffix to...

CHECKOUT TUTORIALS

Java Tutorial #7 Part 1 โ€“ Classes & Objects

Classes are a very important concept in Java. Java code always needs to be written in a class. In this article, we will be...
- Advertisement -spot_img