简体   繁体   English

NetBeans 添加外部库 Vaadin 框架

[英]NetBeans adding external library Vaadin Framework

How can I add external library to Vaadin framework using NetBeans?如何使用 NetBeans 将外部库添加到 Vaadin 框架? I can't find libraries folder there.我在那里找不到库文件夹。 Additionally I want use pi4j library.另外我想使用pi4j库。

在此处输入图像描述

I haven't seen it there like in normal Java Application Libraries folder.我没有像在普通的 Java Application Libraries 文件夹中那样看到它。

Looks like you are using Maven.看起来你正在使用 Maven。 In that case you have to edit your pom.xml file (you can find it in the Project Files folder in NetBeans).在这种情况下,您必须编辑pom.xml文件(您可以在 NetBeans 的项目文件文件夹中找到它)。

Google for the Maven coordinates for the library you want to include and add the corresponding dependency section in the dependencies section. Google 查找您要包含的库的 Maven 坐标,并在依赖项部分添加相应的依赖项部分。 For example, to add Log4j, you must add the following in your pom.xml:例如,要添加 Log4j,您必须在 pom.xml 中添加以下内容:

...
<dependencies>
    ...
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>2.5</version>
    </dependency>
    ...
</dependencies>
...

Alternatively, you can right click the Dependencies folder in NetBeans, select Add Dependency... , and add the corresponding Maven coordinates or search for the dependency (keep in mind the Maven Index may be updated the first time you search for a dependency, process that might take some seconds/minutes).或者,您可以右键单击 NetBeans 中的Dependencies文件夹,选择Add Dependency... ,然后添加相应的 Maven 坐标或搜索依赖项(请记住,Maven Index 可能会在您第一次搜索依赖项时更新,过程这可能需要几秒钟/分钟)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM