[英]how to configure maven to use local artifact
I'm trying to modify an existing project X and to test it there is another project Y that use the X project's jar (I know it is not the best way to do tests, but there is some constraints) 我正在尝试修改现有项目X并对其进行测试,还有另一个使用X项目jar的项目Y (我知道这不是进行测试的最佳方法,但存在一些约束)
My question is : how to configure maven to use the local version of the project X jar (there is other version of X jar ) ? 我的问题是:如何配置Maven以使用项目X jar的本地版本(还有X jar的其他版本)? I tried to change the dependency version but it doesn't work, I also disable update of local repo and run mvn command offline, but none of these are working . 我试图更改依赖项版本,但是它不起作用,我也禁用了本地存储库更新,并离线运行mvn命令,但是这些都不起作用。
Build project X locally with a different version (like 1.2.3-TEST-SNAPSHOT
) and reference this version in project Y. 使用其他版本(例如1.2.3-TEST-SNAPSHOT
)在本地构建项目X,并在项目Y中引用此版本。
If the projects are both Eclipse projects, you can also use Eclipse workspace resolution to directly resolve against the other project (inside Eclipse). 如果两个项目都是Eclipse项目,则还可以使用Eclipse工作区分辨率直接针对另一个项目(在Eclipse内部)进行解析。
Ok, The first, You must build project X, choose maven build or run mvn clean install. 好的,首先,您必须构建项目X,选择maven build或运行mvn clean install。 Then after success, you can check in folder m2/repository///bla bla. 然后,成功后,您可以检入文件夹m2 / repository /// bla bla。 You can see file X.jar In file pom of project Y, you add dependency of project X. GroupID and ArtifactID of project X you can see in file pom of project X. 您可以看到文件X.jar。在项目Y的文件pom中,添加了项目X的依赖项。可以在项目X的文件pom中看到项目X的GroupID和ArtifactID。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.