Alejandro Duarte

Importing a Maven project in NetBeans

This tutorial explains how to import an existing Maven project into Apache NetBeans and how to associate Maven goals to IDE actions. This is useful, for example, when using the Jetty Maven plugin that allows you to quickly deploy and run a Java web application using this popular server.

Maven is a project management tool that goes beyond dependency management. See Learning Maven Concepts for more.

Download an existing Maven project

This tutorial uses a Maven archetype that generates a Java web application with a preconfigured Jetty Maven Plugin in it:

mvn -B archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=LATEST -DgroupId=org.test -DartifactId=webapp -Dversion=1.0-SNAPSHOT
If you prefer, you can generate a ZIP file with the project at or Make sure you select the Plain Java Servlet option before downloading the project.

The project should include a directory with a Maven project in it:

Maven project directory
You need Node.js installed on your computer to compile the example application.

Import the project

  1. In NetBeans, select File > Open Project…​.

  2. Select the directory corresponding to the Maven project, and click Open Project to complete the process:

    Open project

Running Maven goals

NetBeans has excellent integration with Maven. You can run common commands such as mvn clean or mvn jetty:run without having to leave the IDE.

When you select the project in the Projects view, NetBeans shows common Maven goals inside the Navigator view:

Navigator view

You can execute any of these goals by double-clicking them. For example, you can double-click the jetty run goal to run the web application implemented in the project you imported.

To stop the server, click the stop button in the Output view:

Output view

Binding Maven goals to IDE actions

Since using the jetty:run goal could be a frequent task during the development of a Java web application, you might prefer to bind this Maven goal to an IDE action.

Let’s associate the Run project action to the jetty:run Maven goal.

  1. Right-click the project in the Projects view and select Properties.

  2. In the Project Properties window, select Actions in the Categories tree.

  3. Select the Run project option in the Actions list.

  4. Type jetty:run in Execute Goals.

  5. Click OK:

    If you are using Spring Boot, use the spring-boot:run goal.

Now you can deploy and run the web application by clicking the run icon in the toolbar:


You can repeat the process to bind the jetty:run goal to the Debug project IDE action as well.

If you use the Vaadin project used in the tutorial, you can invoke the web application at http://localhost:8080.

That’s it. Now you can use NetBeans to develop your Maven application. To learn more about:

Vaadin is an open-source framework offering the fastest way to build web apps on Java backends

Comments (9)

Alejandro Duarte
3 years ago Apr 01, 2019 11:59am
olu mide
3 years ago Apr 01, 2019 2:31pm
Alejandro Duarte
3 years ago Apr 01, 2019 3:57pm
Ayşegül Postalcıoğlu
3 years ago Jul 18, 2019 11:17am
olu mide
3 years ago Jul 26, 2019 8:01pm
Alejandro Duarte
3 years ago Jul 29, 2019 12:20pm
Alejandro Duarte
3 years ago Jul 23, 2019 1:06pm