I already have a small Java project. I want to move it to Maven, so I want to create the pom.xml using Eclipse so that I can build it using pom from a command prompt. I have not worked with Maven before, though I have worked with Ant.
How can I create the pom.xml for my Java project using Eclipse?
What is a POM? A Project Object Model or POM is the fundamental unit of work in Maven. It is an XML file that contains information about the project and configuration details used by Maven to build the project. It contains default values for most projects.
The src/main/java directory contains the project source code, the src/test/java directory contains the test source, and the pom. xml file is the project's Project Object Model, or POM.
In the Project tool window, right-click your project and select Add Framework Support. In the dialog that opens, select Maven from the options on the left and click OK. IntelliJ IDEA adds a default POM to the project and generates the standard Maven layout in Project tool window.
You should use the new available m2e plugin for Maven integration in Eclipse. With help of that plugin, you should create a new project and move your sources into that project. These are the steps:
File > New > Project...
Maven
and select Maven Project
and click Next
.Create a simple project
(to skip the archetype selection).jar
, and a Name.Run as > Maven install
.This works for me on Mac:
Right click on the project, select Configure → Convert to Maven Project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With