🎓 Top 15 Udemy Courses (80-90% Discount): My Udemy Courses - Ramesh Fadatare — All my Udemy courses are real-time and project oriented courses.
▶️ Subscribe to My YouTube Channel (178K+ subscribers): Java Guides on YouTube
▶️ For AI, ChatGPT, Web, Tech, and Generative AI, subscribe to another channel: Ramesh Fadatare on YouTube
In this article, we will show you how to create a simple maven project in Eclipse IDE.
We can also create a simple maven project using the command line, check out the same at Create a Simple Maven Project using Command-Line.
Let's test our created project by creating a simple JUnit test.
We can also create a simple maven project using the command line, check out the same at Create a Simple Maven Project using Command-Line.
Video
This tutorial is explained in the below Youtube Video. Subscribe to my youtube channel to learn more about Spring boot at Java Guides - YouTube Channel.Tools and technologies used
- Eclipse Neon
- Maven - 3.5.3
- JDK - 1.8
Step-1
- Open Eclipse
- Click on File -> New -> Maven Project
Step-2
Click on Checkbox for both
Step-3
Provide GroupId and ArtifactId in next screen.
Step-5
As you can see in the maven project structure, the default java compiler version ( i.e. source and target setting ) is 1.5. To change the default settings, add the following snippet to pom.xml.
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.6.0</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build>
After changes in pom.xml file, update the maven project. To update maven project right click on maven-project → Maven → Update Project.
Step-6
Add some dependencies to pom.xml file. Here we are adding junit dependency to pom.xml.
<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>net.javaguides.maven-demo</groupId> <artifactId>maven-demo-project</artifactId> <version>0.0.1-SNAPSHOT</version> <description>Simple Maven Demo Project</description> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.6.0</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build> </project>
Let's test our created project by creating a simple JUnit test.
Step-7
Create a package, named as net.javaguides.simpleproject, under src/test/java folder. Now create a class AppTest.java under src/test/java package and write the following code in it.
package net.javaguides.simpleproject; import org.junit.Assert; import org.junit.Test; public class AppTest { @Test public void test() { Assert.assertEquals("Hello Maven", new String("Hello Maven")); } }
Step-8
Run your first maven project. Right click on AppTest.java → Run as → JUnit Test.
My Top and Bestseller Udemy Courses. The sale is going on with a 70 - 80% discount. The discount coupon has been added to each course below:
Build REST APIs with Spring Boot 4, Spring Security 7, and JWT
🆕 High-Demand
80–90% OFF
[NEW] Learn Apache Maven with IntelliJ IDEA and Java 25
🆕 High-Demand
80–90% OFF
ChatGPT + Generative AI + Prompt Engineering for Beginners
🚀 Trending Now
80–90% OFF
Spring 7 and Spring Boot 4 for Beginners (Includes 8 Projects)
🔥 Bestseller
80–90% OFF
Available in Udemy for Business
Available in Udemy for Business
Building Real-Time REST APIs with Spring Boot - Blog App
🔥 Bestseller
80–90% OFF
Available in Udemy for Business
Available in Udemy for Business
Building Microservices with Spring Boot and Spring Cloud
🌟 Top Rated
80–90% OFF
Available in Udemy for Business
Available in Udemy for Business
Java Full-Stack Developer Course with Spring Boot and React JS
🔥 Bestseller
80–90% OFF
Available in Udemy for Business
Available in Udemy for Business
Build 5 Spring Boot Projects with Java: Line-by-Line Coding
🌟 Top Rated
80–90% OFF
Testing Spring Boot Application with JUnit and Mockito
🔥 Bestseller
80–90% OFF
Available in Udemy for Business
Available in Udemy for Business
Spring Boot Thymeleaf Real-Time Web Application - Blog App
🔥 Bestseller
80–90% OFF
Available in Udemy for Business
Available in Udemy for Business
Master Spring Data JPA with Hibernate
🔥 Bestseller
80–90% OFF
Available in Udemy for Business
Available in Udemy for Business
Spring Boot + Apache Kafka Course - The Practical Guide
🎓 Student Favorite
80–90% OFF
Available in Udemy for Business
Available in Udemy for Business

Comments
Post a Comment
Leave Comment