how to use maven (eclipse keppler) on imported non-maven projects

I have existing projects that I wrote using Eclipse Juno on another machine, on that machine I downloaded the jars I needed (selenium, jxl, sqlite etc.) from the internet manually and then edited the build path to point to them. I need to move these projects over to a different machine which has Eclipse Kepler loaded. I thought I'd use maven to link everything up (with a view to retro-fitting the machine with Juno to use maven) so that as I jump between the two machines everything will be kept in order automatically.

I installed maven from the marketplace and ran the install:install-file command, but it won't run the program as it insists the jars it's looking for aren't installed (which of course they aren't, that's what I thought maven did).

Is it not possible to use maven in this way (get it to download and link up missing jars) for an existing project? Do I need to do it manually, and if so will I have created problems that I'll have to unpick by having tried this with maven?

Answers


If you're using the m2e plugin, you can turn on Maven dependency resolution by just right-clicking on the project and choosing Configure->Convert to Maven project. Make sure your project has a valid pom.xml file and set everything up properly in Preferences->Maven (proxy, user settings, maven installation, ...)

If you're not using m2e, you can use the eclipse maven plugin like this:

mvn eclipse:eclipse

This will call the eclipse goal of the eclipse plugin, and it will generate .project and .classpath files for you with all dependencies pointing to your Maven local repository.

As a side note, the install:install-file goal doesn't have anything to do with what you want to achieve, it's used to install an artifact (a .jar file) to your local Maven repository.


Need Your Help

How to terminate a thread blocking on socket connect

java android multithreading sockets

In my android app, my activity is starting another thread for some socket network operations, and this thread is always waiting for incoming data from the socket(blocking on read() function in a wh...

Use if statement to get percentage of input?

javascript html5

Everything runs correctly, but I want to add a few things. At the very end of the function I want to change the height of the canvas by comparing how many you got correct out of the amount that you