Question

I am new to Maven, and as I added a dependancy in my pom.xml, the dependency got resolved and gets packaged in target/dependencies.

However I do not know how to use them in Eclipse.

It is not in the project's java build path in Eclipse, and even though I can circumvent this in various ways (e.g. manually add the dependencies from the local repo to build path in eclipse), there should be a proper way to manage your dependencies in maven and for Eclipse to be able to "see" the dependencies. I want to add the dependencies on one place (pom.xml) and both maven and eclipse to able to understand that and add them to build path/classpath.

How is this done? Via plugin? Which plugin should I use?

Was it helpful?

Solution

I assume you are using the command line Maven option instead of the eclipse plugin.

if that is the case, then once you have added dependency and did a "mvn install", you need to do "mvn eclipse:eclipse".

Every time you add a dependency and install, you will have to do a eclipse:eclipse else it will not put the new jars in classpath.

Alternatively, switch to m2eclipse

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top