如何将Maven 2集成到现有的netbeans项目中? [英] How to integrate maven 2 in an existing netbeans project?

查看:64
本文介绍了如何将Maven 2集成到现有的netbeans项目中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将Maven 2集成到现有的netbeans项目中?

我不想通过创建新的Maven Web应用程序项目并将文件手动移动到 新项目(因为在我的Subversion存储库中有该项目的版本,如果创建新项目,我将无法链接该版本),而是需要将其集成到我现有的netbeans项目中.我该怎么办?创建pom.xml是否可以工作?


我的机器上已经安装了Maven 2.

解决方案

如何创建一个新的Maven Web项目并将pom.xml移回现有Web项目呢?我的意思是:

  1. 备份您的项目
  2. 创建一个名为MavenWebTest
  3. 的新项目
  4. 关闭您的原始项目
  5. pom.xmlMavenWebTest项目移动到原始项目的文件夹中
  6. 修改pom.xml的项目特定设置(例如,项目名称,依赖项)
  7. 删除build.xml和整个nbproject文件夹
  8. 移动web文件夹并将其重命名为src/main/webapp(webapp是新名称)(如果使用Subversion,请使用svn mv)
  9. src/java移至src/main/java(此处也将svn mv)
  10. 在Netbeans中再次打开您的项目.现在应该是一个Maven项目.
  11. 删除不必要的MavenWebTest项目

无论如何,创建一个空的pom.xml也应该可行.您必须在pom.xml中列出您的依赖项,并且必须设置项目的名称.可能还需要进行其他一些微调才能获得与不使用Maven的Netbeans创建的结果相同的结果.如果您使用Netbeans(上面的MavenWebTest)创建pom.xml,我想大多数Netbeans特定的东西已经存在了.

如果您是Maven的新手,建议您在 Sonatype的网站上查看免费的pdf/html书籍. >

How to integrate maven 2 in an existing netbeans project ?

I dont want to do it by creating a new maven web app project and moving my files manually to the new project(as I have versions of this project in my subversion repositories which I wont be able to link if I create new project), rather I need to integrate that in my already existing netbeans project. How do I go about it ? Would creating a pom.xml work ?


Maven 2 already installed on my machine.

解决方案

What about creating a new Maven Web Project and moving the pom.xml back to your existing Web Project? I mean:

  1. Backup your projects
  2. Create a new project with name MavenWebTest
  3. Close your original project
  4. Move the pom.xml from the MavenWebTest project to your original project's folder
  5. Modify the pom.xml's project specific settings (e.g. project name, dependencies)
  6. Delete the build.xml and the whole nbproject folder
  7. Move and rename the web folder to src/main/webapp (webapp is the new name) (use svn mv if you use Subversion)
  8. Move src/java to src/main/java (svn mv here too)
  9. Open you project again in Netbeans. It should be a Maven project now.
  10. Delete the unnecessary MavenWebTest project

Anyway, creating an empty pom.xml also should work. You have to list your dependencies in the pom.xml and you have to set the project's name. Maybe other fine tunings also required to get the same result as Netbeans create without Maven. If you create the pom.xml with Netbeans (the MavenWebTest above) I suppose that most of Netbeans specific stuff already will be there.

If you are new to Maven I suggest you to check the free pdf/html books on Sonatype's website.

这篇关于如何将Maven 2集成到现有的netbeans项目中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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