Search code examples
javamavenbuildpom.xmlmaven-dependency

Using Java project as jar file in other project as maven dependency


I want to use one maven project as dependency using POM.xml in other project with few limitations.

My Maven project1 is framework project. I have created a jar file for that project. This project will reside in a private git repo. I donot want to expose this project other user to edit it.

In my maven project2 or maven project3 i want to use the maven project1 as dependency. the jar file should be downladed to maven dependencies during run time.

Note: the user will not have mave project1 in his eclipse.

For example: when i add testNG dependency to my POM.xml testNG jar will be downloaded to my project similarly, I need to add my maven project1 as dependency to any other maven project and it should downlod project1 as jar.

Please do let me know how to achieve it.


Solution

  • I guess you should upload your project to the Maven repository: https://maven.apache.org/guides/mini/guide-central-repository-upload.html