Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to integrate maven 2 in an existing netbeans project?

Tags:

maven

netbeans

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.

like image 242
Rajat Gupta Avatar asked Sep 25 '11 19:09

Rajat Gupta


1 Answers

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.

like image 82
palacsint Avatar answered Oct 05 '22 07:10

palacsint