Search code examples
javamavennetbeansrestfb

how to add restfb. jar to maven project on Apache NetBeans IDE 11.1? No libraries category in Project - >properties


I have a project in which i use Apache Netbeans IDE 11.1 and I want to use Facebook API by adding "restFB.jar" to my project

in previous versions of NetBeans, there was "Libraries" category in Project->Properties

but now in Apache Netbeans IDE 11.1 I can't find the "Libraries" Category .

How can I Add "restFB.jar" to my project in Apache Netbeans IDE 11.1

Below is what I am trying to do. Image 1 Image 2 Thanx in advance


Solution

  • The absence of the Category named Libraries for your project is nothing to do with NetBeans 11.1. Maven projects in any version of NetBeans will not have a Category named Libraries because it is not needed. Instead, your application's dependencies are specified within pom.xml.

    You can easily verify this by using the NetBeans project wizard:

    • Create a Maven based application (File > New Project... > Java with Maven > Java Application).
    • Create an Ant based application (File > New Project... > Java with Ant > Java Application).
    • The Ant application will have a Category named Libraries, and the Maven project will not.

    So to include restFB.jar in your Maven project:

    • Go to https://mvnrepository.com and search for "restfb".
    • A list of the possible choices will be shown. You want the topmost one named RestFB, so click that.
    • On the RestFB page the topmost entry is the one you are looking for (3.0.0-rc.1), so click that link.
    • The <dependency> entry you need to add to pom.xml will be displayed on the Maven tab.
    • Click that entry to copy it to the clipboard, then add it to the pom.xml for your project and rebuild.

    This is the Maven web page you need to copy the <dependency> entry:

    MavenRestFb

    There are several sample RestFB examples on GitHub which may be helpful. If you get stuck on your own project, try building and running those to help understand and isolate any other issues with your project.