简体   繁体   English

如何为现有的netbeans项目“添加Maven性质”?

[英]How to “add Maven nature” to existing netbeans project?

I know "adding Maven nature" is an Eclipse term. 我知道“添加Maven性质”是一个Eclipse术语。

Actually I want to add SOME dependencies from maven repository by editing pom.xml file. 实际上,我想通过编辑pom.xml文件从Maven存储库中添加一些依赖项。 Is it possible? 可能吗? I want to remain a directory structure and other JAR tracking of a project intact. 我想保留一个项目的目录结构和其他JAR跟踪。

The project is of jMonkey SDK. 该项目是jMonkey SDK的。

in netbeans there are no natures. 在netbeans中没有自然。 Either the project is a maven project (by having a pom.xml file in project directory) or it's not. 该项目是Maven项目(通过在项目目录中包含pom.xml文件),还是不是。 No matter what type, projects are just opened. 无论哪种类型,项目都是打开的。

if your project is both ant based project (having nbproject/project.xml file and build script) and contains pom.xml, then the ant project takes priority and will be opened as ant project. 如果您的项目都是基于ant的项目(具有nbproject / project.xml文件和构建脚本)并且包含pom.xml,则ant项目具有优先权,并将作为ant项目打开。 No way to mix then. 那没办法混。 to load as maven project you will have to delete ant project related files and restart the IDE. 要将其加载为Maven项目,必须删除与ant项目相关的文件并重新启动IDE。

  • add minimal pom.xml file 添加最小的pom.xml文件
  • close project 结束专案
  • re import it to netbeans as maven project 将其重新导入到netbeans作为Maven项目

  • or create a new minimal maven project and delete source and resource directories and place your project stsructure and 或创建一个新的最小Maven项目并删除源和资源目录,然后放置项目结构和

  • configure pom.xml to match with your directory structure 配置pom.xml以与您的目录结构匹配

    • by specifying resources & source directories in pom.xml 通过在pom.xml中指定资源和源目录

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

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