Reputation: 189
Typically when I want to use a library, I end up downloading it and importing it manually into my Eclipse project, simply because I don't know how to use Maven, repos, etc. with Eclipse. This isn't ideal. With some things its simply copying and pasting a folder, but other times it is messy and time consuming.
So far I have managed to import Maven libraries as their own projects, import maven libraries to my own projects but have them fail to compile due to class not found exceptions despite them being in the build path, and I think how to make my own Maven project. None of these are what I am trying to do.
I uninstalled all of the maven plugins I have tried to use to get this to work to try to start fresh.
I am very comfortable with adding .jars to eclipse. They are added to individual projects, just like other resources and automatically are added to the build path. (For example, if I import a jar that contains Foo.class I can say new Foo()
in my own code and it will compile and run). Currently, I am trying to add this library for a personal project. When I try to import it into eclipse, it creates a dozen new projects. The problem is that I want to import it into an existing project, as if it were any other library. I could go through the folders and manually copy what I need directly into my workspace, but I have a feeling that isn't the right way to do this, and it's especially annoying that one of the test classes that I want to look at requires another maven library. Everywhere I look on google seems to require you already know more than I do to get it to work. here also seems to be hundreds of addons for eclipse to integrate maven, and it seems eclipse already has some maven support built in. This has caused me hours of confusion, and I still don't know much more than when I started.
Upvotes: 3
Views: 124
Reputation: 3795
If you want to use maven dependencies then you need to be using maven for your build. If you are using maven for your build then the m2e
eclipse plugin is a great way to integrate mvn and eclipse.
I don't believe there is any shortcut. AFAIK, trying to do this without using maven as your build system will just cause you a lot of pain.
Upvotes: 1
Reputation: 6302
The easiest way to add dependencies to Eclipse from Maven:
Then the dependencies will be on the project.
Upvotes: 0