Maven: How to include jars in Eclipse, which are not available in repository?

fjjiaboming picture fjjiaboming · Oct 6, 2011 · Viewed 60.9k times · Source

I have copied the JARs into src\main\webapp\WEB-INF\lib.
I use eclipse. If I add the jars one-by-one to Project-> Java Build Path-> Add jars, then I do Project-> Maven-> Update Project Configuration, they are removed by Maven. And Eclipse shows errors, which contain " xxx cannot be resolved".

Env:
Eclipse Java EE IDE for Web Developers.
Version: Indigo Service Release 1
Build id: 20110916-0149

m2e - Maven Integration for Eclipse 1.0.100.20110804-1717

Note: I don't want to create my own Maven repository. It will be just used once.
How should I proceed ?

Answer

stivlo picture stivlo · Oct 6, 2011

Not all libraries can be found in a public Maven repository, for example your own libraries or proprietary libraries. Anyway first you can search the Maven Repository, maybe some of them are there.

In case they are really not there, and you don't want to install Nexus or Artifactory, you can choose one of these two approaches:

  • install the jars in your local repository cache, no need to create a special repository. See the instructions on mkyong.

  • another approach is using system dependencies, you just put a path to reach the Jar in the filesystem. It's a less recommended approach, but if you really want it will work. Here is the official documentation.