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

查看:27
本文介绍了将 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天全站免登陆