简体   繁体   English

Maven,添加另一个项目父pom和模块作为依赖,就好像它们是你的一样

[英]Maven, adding another project parent pom and modules as a dependency, as if they were yours

There is a project on github , which has a parent pom and sub modules . github 上有一个项目,它有一个父 pom子模块

I have a project like that too .我也有一个这样的项目

I'd like that code to get into my editor as if it was my project, and i could edit and navigate to those files ... but I am not able to successfully do that.我希望该代码进入我的编辑器,就好像它是我的项目一样,我可以编辑和导航到这些文件......但我无法成功做到这一点。

In my parent pom, i've tried to add the parent module:我的父pom 中,我尝试添加父模块:

<module>./GITHUBROJECT/GITHUBROJECT-core</module>
<module>./GITHUBROJECT/GITHUBROJECT-api</module>

and/or just the parent pom path, hoping it would read that pom and resolve all child modules :和/或只是父 pom 路径,希望它能读取该 pom 并解析所有子模块

<module>./GITHUBROJECT/GITHUBROJECT-api</module>

and tried to add all child modules as well.并尝试添加所有子模块。

Then in my "Core" module, I add the dependency, but each time, it seems to always resolve to jar resources when using Intellij but for my own projects it always resolve to the local version .然后在我的“核心”模块中,我添加了依赖项,但每次使用 Intellij 时它似乎总是解析为jar 资源,但对于我自己的项目,它总是解析为本地版本

<dependency>
    <groupId>com.GITHUBPROJECT</groupId>
    <artifactId>GITHUBPROJECT</artifactId>
    <version>1.2.2</version>
</dependency>

Is this possible?这可能吗?

Maven does not work this way, it does not ever resolve dependencies on source . Maven 不是这样工作的,它永远不会解决对source 的依赖。 It resolves on compiled and installed artifacts regardless of where they are in the parent child hierarchy.它解析已编译和已安装的工件,而不管它们在父子层次结构中的位置。

You still have to mvn install to get the dependencies to resolve.您仍然必须mvn install才能解决依赖项。

If you are forking a project you need to change the groupId at the least so that you can resolve against your fork rather than the original.如果您要分叉一个项目,您至少需要更改groupId ,以便您可以针对您的分叉而不是原始项目进行解析。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM