I am new to maven and I am trying to design an app which uses a lot of referenced libraries (jars and class folders) my question is where referenced libraries should be placed in project structure? If in src/main/resources
then how to do this configuration in Eclipse? Eclipse by default, when exporting, adds referenced libraries in the exported jar's home and if you have a lot of libraries this creates a mess in the structure of the jar.
Asked
Active
Viewed 1,310 times
0

tur1ng
- 1,082
- 1
- 10
- 24
-
3Generally, in Maven (and Gradle) projects, you don't "place" referenced libraries ANYWHERE in the project structure, you simply declare your dependencies in the POM, and Maven does the work of downloading those dependencies from your declared (or implicit) repositories into your local Maven cache. – David M. Karr Mar 20 '17 at 00:10
1 Answers
0
In your pom.xml
(usually in the root folder) you should add the library
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.0</version>
</dependency>
that would be the gson library for example.

Eclipse
- 175
- 1
- 12
-
My problem is that this option exports libraries in the jar's home. I am going to use about 6-7 libraries so jar structure becomes a mess. How can I avoid this mess? – tur1ng Mar 19 '17 at 15:31
-
What do you mean by `this options exports libraries in the jars home`? – khmarbaise Mar 19 '17 at 19:20
-
-
Sorry but I don't get it. The resulting jar will not contain the dependency it's only on the classpath ? Maybe you could put your pom file into the question so we can have a look at it... – khmarbaise Mar 19 '17 at 22:22