-2

I have Java Maven Project with a folder lib with all jars that must be included in my project.

I don't know how I have to modify the POM to add all libraries. I want that Maven uses this libraries and I can use all in the project.

r.diazgonz
  • 91
  • 1
  • 1
  • 9
  • So are you shipping these libraries with your project, or do you expect maven to download them for you? – Mureinik Mar 13 '15 at 13:18
  • I have the libraries in my folder project, so I want to import this to my project. – r.diazgonz Mar 13 '15 at 13:22
  • Best and simplest solution is to install the jar into a repository manager and furthermore you can use it as a default dependency. That's it. A lib folder shows you are trying to prevent the Maven concept. – khmarbaise Mar 14 '15 at 12:22

2 Answers2

2

Lets be frank here: you are basically asking how to use Maven but then not use it at the same time. Maven is built around the fact that dependencies are managed from dependable repositories and then you come along and want to bypass that entire system by having local jars anyway as you would have in a project not managed through Maven - like one that is built with ANT.

The true clean solution to "not getting jars from a Maven repository" is to still get them from a repository - your own. Setup a local repository and put your third party dependencies there, then configure your Maven build to know about that local repository. If they are actually dependencies that exist in Maven central then you can setup your local repository to proxy them rather than manually installing them yourself.

http://maven.apache.org/repository-management.html

If you are using the release management features of Maven (or something like Hudson) then you should actually already have such a thing to stick your generated release artifacts into.

Gimby
  • 5,095
  • 2
  • 35
  • 47
0

You have to know which libraries are you using. Imagine that you use in your project the joda-time library.

So you have to search your libraries (in this case joda-time) in maven repositories and add to your pom.xml like the following:

<dependency>
    <groupId>joda-time</groupId>
    <artifactId>joda-time</artifactId>
    <version>2.7</version>
</dependency>

Here the Maven repository --> Maven Repo

Iker Aguayo
  • 3,980
  • 4
  • 37
  • 49