NetBeans and the Maven project


Hello i have a maven project build in netbeans.

issue i having is i have some external dependencies jar libraries that i need to make my source file work.

example: on my source code import org.cloudme.puppet ( which i have a jar for )

now in java project for net means i have "library" where you can right click and "add jar/folder"

with the maven project i do not have that, i have a " Dependencies " folder ,, which will NOT let me right click and add JAR*

so how can i bring them in ? how can i get my source code to find those dependencies ?

i have tried .. i even created a new java class project, but that cannot be picked up my main project.

please help, any direction will help

You have two options.

1. Use the Maven query tool to find the Group/Artifact/Version you're looking for and add it directly to your pom.xml file.

The preferred way of getting your dependencies onto the classpath of your Maven project would be to add the maven artifact corresponding to your import to your project's pom.xml file. In NetBeans, you can do this easily by right-clicking the Dependencies folder of your Maven project in the Projects view and choosing "Add Dependency". This will bring up a query tool that will allow you to search your maven repositories (configured in the settings.xml of your .m2 folder) for org.cloudme.puppet or any other package/class name you require. If NetBeans can't find the correct GroupID/Artifact ID/Version for the packages/classes you're looking for, you can visit and perform a similar query against an internet-visible maven repository. I've found about 90% of everything I've ever needed there - it's a great resource.

2. Manually create a subfolder in your project for your jars, then add them to your pom.xml file as "system" dependencies.

This answer will make Maven purists really upset ... but sometimes the class you're trying to import simply doesn't exist as a maven project, and you have to use a raw Jar file because you don't have source code. If this is the case, you'll want to add it to your project in its own "lib" folder (or whatever you choose to call it), then add it to your pom.xml dependency list as a system dependency. For more info on configuring system dependencies in Maven, look here: