在 Maven Netbeans 中添加依赖项
我创建了一个 Maven 项目并添加了我需要的依赖项(jar 文件);然而,Netbeans 表示仍然找不到它。
具体来说,就我而言,我将 jmf-2.1.1e.jar 文件添加到我的依赖项文件夹中。当我返回程序时,它仍然给出编译错误,指出它找不到 javax.media 包。
I've created a Maven project and added the dependencies (jar files) that I need; however, netbeans says that it still cannot find it.
Specifically in my case, I added the jmf-2.1.1e.jar file into my dependencies folder. When I go back to my program it still gives me the compile error that it cannot find the javax.media package.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您是否让 Netbeans 管理依赖关系?
在“项目”列表中,找到并单击上下文中的“依赖项”文件夹。从上下文菜单中选择“添加依赖项”。
此方法至少适用于 NetBeans 7.4 和 8.0 beta。
Did you let Netbeans manage the dependency?
In your "Projects" listing, find and context+click on the "Dependencies" folder in the list. From the context menu, choose "Add Dependency".
This approach works at least in NetBeans 7.4 and 8.0 beta.
确保您的
pom.xml
具有以下定义依赖项的代码片段Make sure that your
pom.xml
has the following snippet that defines the dependency该依赖项可在 Maven Central 中找到。将 pom 片段手动添加到 pom.xml 并在 shell 中运行 Maven 并让它下载依赖项。这应该可以解决您的问题。
The dependency is available in Maven Central. Add the pom snippet manually to the pom.xml and run Maven in the shell and let it download the dependency. This should resolve your issue.
一旦在 pom.xml 中指定,Maven 就会自动下载依赖项。为此,您必须使用 Tim Sparg 指定的依赖项来构建项目。
Maven automatically downloads the dependency once specified in the pom.xml. For this you would have to build your project with the dependency as specified by Tim Sparg.