views:

556

answers:

2

For a project at work, we're considering using the Maven plugin for Eclipse to automate our builds. Right now the procedure is far more complicated than it ought to be, and we're hoping that Maven will simplify things to a one-click build.

My question is, is there a wizard or automatic importer for converting an existing Eclipse Java project to a Maven project, using the Maven plugin? Or should I create a new Maven project and manually copy over all source files, libs, etc.

+3  A: 

If you just want to create a default POM and enable m2eclipse features: so I'm assuming you do not currently have an alternative automated build setup you're trying to import, and I'm assuming you're talking about the m2eclipse plugin.

The m2eclipse plugin provides a right-click option on a project, submenu Maven, option Enable Dependency Management. That'll do the necessary to enable the plugin for that project.


To answer 'is there an automatic importer or wizard?': not that I know of. Using he option above will allow you to enable the m2eclipse plugin for your existing project avoiding the manual copying. You will still need to actually set up the dependencies and other stuff you need to build yourself.

Brabster
yes, it does ;)
Bozho
Although it enables M2Eclipse, it's not really a wizard not does it import an existing Eclipse project. Rather, it gives the user an option of selecting dependencies, etc., which may be difficult if the user doesn't have much experience with Maven.
Kaleb Pederson
I interpreted the question as 'do I need to create a new project and manually copy stuff around to use the m2eclipse plugin?', I'll clarify.
Brabster
Yes, I was looking specifically at the m2eclipse plugin -- it's the one suggested on the Maven website, and looks like it's decently supported.
Tom G
+1  A: 

My question is, is there a wizard or automatic importer for converting an existing Eclipse Java project to a Maven project, using the Maven plugin?

AFAIK, there is nothing that will automagically convert an Eclipse project into a Maven project (i.e. modify the layout, create a POM, "generate" and feed it with metadata, detect libraries and their versions to add them to the POM, etc). Eclipse just doesn't have enough metadata to make this possible (this is precisely the point of the POM) and/or to produce a decent result.

Or should I create a new Maven project and manually copy over all source files, libs, etc

That would be the best option IMO. Create a Maven project, copy/move sources, resources, tests, test resources into their respective directories, declare dependencies, etc.

Pascal Thivent