将Netbeans项目转换为启用Maven的项目 [英] Converting a Netbeans project to a Maven enabled project

查看:90
本文介绍了将Netbeans项目转换为启用Maven的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将Netbeans生成的项目转换为接受Maven配置?有创建基于Maven的项目的选项,但是(到目前为止,我还没有发现)没有任何东西可以将Maven依赖项添加到现有项目中.

How can I transition a Netbeans generated project into accepting a Maven configuration? There are options to create Maven based projects, but there is nothing (that I've found so far) to add Maven dependencies to existing projects.

推荐答案

您需要创建一个单独的Maven项目.然后,您可以将代码从其他项目复制到Maven项目.这可以从NetBeans的项目"窗口中完成.

You need to create a separate Maven Project. Then, you can copy the code from your other project to the Maven project. This can be done from the Projects windows in NetBeans.

只需在树中选择代码文件/程序包,右键单击以进行复制,然后将它们粘贴到新的Maven项目的源程序包"中.

Just select the code files/packages in the tree, right-click for copy, then paste them in the Source Packages of your new Maven project.

接下来,打开Maven无法编译的文件,因为它们会丢失依赖项.问题行左侧的黄色灯泡将为您提供搜索缺失的依赖项并将其添加到项目中的选项.您需要在线才能执行搜索.

Next, open the files which Maven won't compile because they miss dependencies. The yellow bulb on the left of the problematic line will give you options to search for missing dependencies and add them to your project. You need to be online to perform searches.

还可以通过在项目"窗口中右键单击依赖项文件夹,在新的Maven项目中手动添加Maven依赖项.

You can also add maven dependencies manually in your new Maven project by right-clicking the dependencies folder in the Projects windows.

这篇关于将Netbeans项目转换为启用Maven的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆