Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting a Netbeans project to a Maven enabled project

Tags:

maven

netbeans

How can I transition a Netbeans generated project into accepting a Maven configuration? There are options to create Maven based projects, but there is nothing (that I've found so far) to add Maven dependencies to existing projects.

like image 495
monksy Avatar asked Mar 31 '11 04:03

monksy


People also ask

Can I use Maven in NetBeans?

You can Launch Maven builds from within NetBeans. NetBeans does the dependency management automatically based on Maven's pom. xml. NetBeans resolves Maven dependencies from its workspace without installing to local Maven repository (requires dependency project be in same workspace).

How do I create a Maven project in NetBeans?

Choose File > New Project (Ctrl-Shift-N). As explained in the previous section, select NetBeans Module from the Maven category. Click Next. Type TextFilter for the Project Name.


1 Answers

You need to create a separate Maven Project. Then, you can copy the code from your other project to the Maven project. This can be done from the Projects windows in NetBeans.

Just select the code files/packages in the tree, right-click for copy, then paste them in the Source Packages of your new Maven project.

Next, open the files which Maven won't compile because they miss dependencies. The yellow bulb on the left of the problematic line will give you options to search for missing dependencies and add them to your project. You need to be online to perform searches.

You can also add maven dependencies manually in your new Maven project by right-clicking the dependencies folder in the Projects windows.

like image 182
Jérôme Verstrynge Avatar answered Oct 02 '22 23:10

Jérôme Verstrynge