I created the java class and converted into jar files. So, I want to use those jar files which I have placed in project level in some folder like "External Jar". So I need to write a dependency in maven that when someone imports my project they should be able to run the program.
Asked
Active
Viewed 742 times
1 Answers
4
Basically you created your own jar and you want to publish this jar, so that when somebody else clone/use your project, this jar comes with (assuming that you have a maven project and dependency of your jar is included in pom.xml).
To achieve this, you need to publish your jar to maven , you can follow many of the online docs like http://kirang89.github.io/blog/2013/01/20/uploading-your-jar-to-maven-central/ on how to publish jar to maven central.
Edit:- As suggested by khmarbaise, please use official reference http://central.sonatype.org/ for central repository.

Amit
- 30,756
- 6
- 57
- 88
-
Can't we place that jar in any folder in project level and create dependency for it in maven? – Krishna Barri Apr 18 '17 at 15:40
-
thats no the recommended way. maven by default look for dependency in `.m2` folder of users `home` directory and by putting jar in project , you loose the essence of dependency management aspect of maven, which encourage to have a central repo where you publish your artifacts. – Amit Apr 18 '17 at 15:41
-
Thanks alot Amit :) – Krishna Barri Apr 18 '17 at 15:43