使用Java项目作为其他项目中的jar文件作为Maven依赖项 [英] Using Java project as jar file in other project as maven dependency

查看:547
本文介绍了使用Java项目作为其他项目中的jar文件作为Maven依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用一个Maven项目作为依赖项,而在其他项目中使用POM.xml进行限制很少.

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

我的Maven project1是框架项目.我已经为该项目创建了一个jar文件.该项目将驻留在私人git仓库中.我不想向其他用户公开此项目.

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.

在我的maven project2或maven project3中,我想使用maven project1作为依赖项.在运行时应将jar文件降级为Maven依赖项.

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.

注意:用户在日食中将不会有mave project1.

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

例如:当我将testNG依赖项添加到我的POM.xml中时,testNG jar将类似地下载到我的项目中,我需要将maven project1作为依赖项添加到任何其他maven项目中,并且应该将project1下调为jar.

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.

请让我知道如何实现.

推荐答案

我想您应该将项目上传到Maven存储库: https://maven.apache.org/guides/mini/guide-central-repository-upload.html

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

这篇关于使用Java项目作为其他项目中的jar文件作为Maven依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆