KFL
KFL

Reputation: 17850

NetBeans: How to add library from Maven repo for non-maven project

For a plain "Java application" project, how can I add a dependency or library from Maven? If I right click on "Libraries" in the projects pane, it only allows me to add local libraries. But if my project is a Maven Java Application, then there's the "Dependencies" node in the projects pane, and from there I can right click and choose "Add dependency...".

I'm using NetBeans 8.0.

Upvotes: 6

Views: 5730

Answers (2)

Andre
Andre

Reputation: 410

You need to build a Maven style project before NetBeans can use its built in Maven plugin - to help you with dependencies.

See http://maven.apache.org/

Install Maven per the instructions exactly. Then you can generate a new Maven style project on the command line with

mvn archetype:generate

and import the generated project into NetBeans.

Upvotes: -1

Puce
Puce

Reputation: 38132

You can either download the library manually e.g. from http://search.maven.org (don't forget the transitive dependencies as well!). Or if you're using Ant (the default project type in NetBeans): consider to use Ant Ivy to manage your dependencies.

Upvotes: 2

Related Questions