Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add pom.xml to existing Eclipse project?

I'm new to Maven and use Eclipse Juno. I've installed Maven Integration for Eclipse. There are three options in File > New > Other > Maven:
1. Checkout Maven Projects from SCM
2. Maven Module
3. Maven Project

But I don't see Maven2 POM as described here. I've read that adding pom.xml is the first thing to do when using Maven.

I have an existing Dynamic Web Project so I'm not sure whether I need to create Maven Project just to use Maven.

How to use Maven with this existing project?

Further, when I try to add Maven Project and on step "Select an Archetype", then all shown archetypes have version "RELEASE". When I click Next on this step, Eclipse becomes Not Responding. It's used memory doesn't even increase.

like image 349
Andrei Botalov Avatar asked Aug 05 '12 17:08

Andrei Botalov


People also ask

How do I add POM xml to an existing project in Eclipse?

You need to import the project as a Maven project. File -> Import -> Maven -> Import existing Maven project.

How do I add Maven dependencies to an existing project in Eclipse?

Via the Maven index, you can search for dependencies, select them and add them to your pom file. To download the index, select Windows > Preferences > Maven and enable the Download repository index updates on startup option. After changing this setting, restart Eclipse. This triggers the download of the Maven index.

How do I run a pom xml file in Eclipse?

Finally, with a modern version of Eclipse, just do "Import > Maven > Existing project into workspace..." and select your pom. xml. M2e will automatically manage your dependencies and download them as required. It also supports Maven builds through a new "Run as Maven build..." interface.


2 Answers

Take a look here :

  • Convert Existing Eclipse Project to Maven Project

In last version of eclipse (Juno included), there is a more convinient wizard :

Configure > Convert to maven project
like image 153
Jean-Rémy Revy Avatar answered Sep 28 '22 18:09

Jean-Rémy Revy


You need to import the project as a Maven project.

File -> Import -> Maven -> Import existing Maven project.
like image 21
Andrew T Finnell Avatar answered Sep 29 '22 18:09

Andrew T Finnell