0

How to export a java maven file from eclipse with all external libraries and maven dependacies so the other peorson opening does not have to download and import the external libraries?

I tried the Archive file exporting method. But it wasn't successful, cause it lost the external libraries while importing, and it lost clases and packages .

  • The whole point about a Maven build file is that it gets the dependencies for you. In theory all you need to do is give them pom.xml and it will do all that's required – g00se Jan 12 '23 at 22:46
  • Its the thing that its a java project with maven dependancies, cant have one without having the other – newbieprogammer Jan 12 '23 at 23:27
  • Sorry I don't understand your comment at all – g00se Jan 13 '23 at 00:04
  • If you like to achieve that you have to make a configuration to build a resulting jar (executable jar via maven-shade-plugin/maven-assembly-plugin) or creating a zip/tar archive with maven-assembly-plugin depending on your requirements. – khmarbaise Jan 13 '23 at 07:03

1 Answers1

1

The default local repository is located based on OS:

Windows: C:\Users<User_Name>.m2

Linux: /home/<User_Name>/.m2

Mac: /Users/<user_name>/.m2

Assuming that you want to store these dependencies in the project folder so that every user does not have to download and import the external libraries according to this source you can download all your dependencies to the target folder with the following command.

mvn install dependency:copy-dependencies

You can also specify the folder.

mvn dependency:copy-dependencies -DoutputDirectory=specific-folder/

To make use of these commands you will have to install Apache Maven Dependency Plugin

k.agoris
  • 33
  • 1
  • 7