官术网_书友最值得收藏!

  • PrimeFaces Theme Development
  • Andy Bailey Sudheer Jonna
  • 455字
  • 2021-07-09 21:12:22

Adding the PrimeFaces library and related dependencies to our project

We will use Maven to add all the required resources that we don't create ourselves, and this section will help us to understand how we add libraries to our project. PrimeFaces only requires that the PrimeFaces JAR file be added to our project. So, this is what we do:

  1. By clicking on the + symbol to the left of the project in the Project view, we open the project tree, as follows:
    Adding the PrimeFaces library and related dependencies to our project

    The following is a brief explanation of the folders, as listed in the previous screenshot:

    • Web Pages: This is where we will add views or pages to our application.
    • Source Packages: Here, Java source code is managed.
    • Other Sources: This allows us to add other types of files which may be needed for the project. We will use this facility. So, its purpose should become clear, eventually.
    • Dependencies: Here we tell Maven the JAR files that we want to add to our project.
    • Runtime Dependencies and Java Dependencies: These are not important for this project. Feel free to browse them at your leisure.
    • Project Files: This is where NetBeans manages both the Maven project's pom.xml file and the NetBeans project configuration file. While we don't need to look at these now, we will visit the pom.xml file in the later chapters. So, if you want to preview these files, please feel free to do so.
  2. Meanwhile, we are going to add PrimeFaces 5.2 to our project. Right-click on the Dependencies folder and select Add Dependency... from the context menu. This opens the Add Dependency dialog box, as shown in the following screenshot:
    Adding the PrimeFaces library and related dependencies to our project

    Usually, you only have the Search tab available in a newly created project.

    Tip

    Maven allows us to add local projects as dependencies to a project, which is what the Open Projects tab is for. It also allows us to add dependencies that are defined in a parent Maven project file, and this is what the Dependency Management tab is for.

  3. Type org.primefaces into the Query field of the Search tab, and then go and make a drink or something that takes a little time.

    Tip

    Not only have we earned a break, but we also need time to allow Maven to download and install the Maven Central Repository index in our local Maven repository. This takes time because there are a very large number of resources available there. If you already use Maven for your projects, you obviously won't need a lot of time. The break might be welcome, though.

    Once the Maven Central Repository index is available, you will see something like this:

    Adding the PrimeFaces library and related dependencies to our project
  4. Select the 5.2 version and click on Add. Maven then adds the dependency to our project.
主站蜘蛛池模板: 瑞昌市| 肥乡县| 崇义县| 唐山市| 四子王旗| 文化| 岳普湖县| 澄迈县| 宁都县| 永康市| 大厂| 塘沽区| 若羌县| 江陵县| 景洪市| 巴楚县| 泾川县| 贺州市| 安乡县| 灌阳县| 浏阳市| 彭阳县| 文昌市| 井陉县| 望谟县| 宜春市| 永年县| 加查县| 井冈山市| 瑞安市| 大关县| 新干县| 油尖旺区| 尼勒克县| 翁源县| 和龙市| 于都县| 八宿县| 乐山市| 灵璧县| 北安市|