# Java Maven Project

Create a Maven project in IntelliJ IDEA, find your way around its folders, and write and run your first Java class.

Novice · Java · Updated November 16, 2026

By Gregor Dzierzon

A Java project is a folder with one or more `.java` files that together make one program. A **Maven** project adds a `pom.xml` file that tells Maven how to build and run it.

Let's create your first Maven project in IntelliJ IDEA. You'll use it for the practice in the next few lessons.

## Step 1: Create a Maven Project

1. Open IntelliJ IDEA and click **New Project**.
1. Select **Java** on the left.
1. Set **Name** to `java-basics`.
1. Set **Build system** to **Maven**.
1. Choose your JDK in the **JDK** list.
1. Leave **Add sample code** checked.
1. Open **Advanced Settings** and set **GroupId** to `com.askcodey`.
1. Click **Create**.

IntelliJ creates the project folder with a `pom.xml` file, the main file of any Maven project: it holds everything Maven needs to build and run your code.

Structure Example:

```text
java-basics/
  ├── src/
  ├── pom.xml
```

To open the project again later, choose **Open** on the Welcome screen and select the folder that contains `pom.xml`. IntelliJ recognizes it as a Maven project from the `pom.xml` file.

## Step 2: Understand the Maven Folder and File Structure

Once your project is open, you'll see a specific structure within IntelliJ that follows Maven's standard layout. Here’s a breakdown of the common folders and files you’ll encounter:

`src/main/java`: This is where your main Java source code goes. For instance, if you are working on a package called `com.askcodey`, you’d place your code here.

```text
  src/
  └── main/
      └── java/
          └── com/
              └── askcodey/
                  └── Application.java  // Your Java class files
```

`src/test/java`: This folder is for your test Java source code.

```text
  src/
  └── test/
      └── java/
          └── com/
              └── askcodey/
                  └── ApplicationTest.java  // Your test class files
```

## Step 3: A Simple Java Class Example

To give you a concrete example, let's create a simple Java class in `com.askcodey`.

Right click on the `com.askcodey` package and create a new Java class.

![IntelliJ's right-click menu on the com.askcodey package, with New, then Java Class highlighted](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/09/f545107d5b28478ab007690fbb40088b.png)

Name the class `HelloTutorials` and add the following code:

```java
package com.askcodey;

public class HelloTutorials
{
    public static void main(String[] args) {
        System.out.println("Hello Tutorials");
    }
}
```

## Step 4: Running Your Java Class

Click the green **Run** arrow beside `main` in the `HelloTutorials` class.

![The green Run arrow beside the main method of HelloTutorials](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/09/1392be9a642f40e6b21e526d7cc97bb6.png)

You should see `Hello Tutorials` printed in the console window at the bottom.

## Do it: print the pizzeria's welcome sign

Build-It Pizzeria wants the computer at its counter to greet customers when the program starts.

The box below holds `Main.java`, a shorter form of the class you wrote above. Since Java 25, a small program can be a `void main()` method with nothing around it: no `public class` line and no `public static`. `main()` still runs when the program starts. Right now it prints `Hello Tutorials`.

Your program should print exactly these three lines, in this order:

```text
Welcome to Build-It Pizzeria!
Build your own pizza.
Open every day, 11 AM to 10 PM.
```

**Your job:** change `main()` so it prints the three lines above.

- Print each line with its own instruction, in the order shown.
- Copy each line exactly: the same capital letters, spaces and punctuation.
- Print nothing else, so the `Hello Tutorials` line goes.

Practiced live on the lesson page: write the Java right there and check it.

## Cheat sheets

- [Java Maven Project](https://www.ask-codey.com/cheat-sheets/java-projects-java-maven-project-cheat-sheet)

Source: https://www.ask-codey.com/lessons/java-projects-java-maven-project
