May 29, 2008

Add Maven dependency directly in NetBeans

Maven support in NetBeans is great. To add a dependency to a Maven project is simple. We go to the Window | Maven Repository Browser and browse to the dependency we need. For this example we add the org.springframework/spring library to our project. We open the Central Repository and browse to the correct node. Now we right-click on the 2.5.4 [jar] node:We select the Add as dependency to option and now we get the following dialog window, where we can select the correct Maven project: And the dependency is now added to our pom.xml.