使用外部依赖项在Git中切换分支 [英] Switching branches in Git with external dependencies

查看:118
本文介绍了使用外部依赖项在Git中切换分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在具有Maven(或任何其他外部)依赖项的项目中,是否有人需要处理切换git分支的问题?例如,假设在一个分支中我有一个maven依赖项,而在另一个分支中我没有(或需要一个不同的版本)。每次切换分支时,是否需要重新导入Maven依赖项?还是有更好的方法?

Has anyone had to deal with the issues of switching git branches in a project that has Maven (or any other external) dependencies? For example, suppose that in one branch I have a maven dependency, and in another I don't (or have a different version required). Would I have to re-import maven dependencies each time I switch branches or is there a better approach?

推荐答案

这实际上取决于您正在使用的IDE。使用IntelliJ IDEA时,我还没有发现任何问题。它可以非常顺畅地处理文件系统级别上的所有 pom.xml 更改。

It actually depends on an IDE you're using. I haven't noticed any issue with this when using IntelliJ IDEA. It handles any pom.xml changes on the filesystem level very smoothly.

但是,前一段时间,当我在使用Eclipse时,我相信我看到了您正在谈论的此类问题。然后,需要重新导入Maven项目,以使IDE知道Maven模型的更改。不过,我不确定Eclipse对Maven的支持如今是否成熟。

However, some time ago, when I was using Eclipse, I believe I saw such a problem you're talking about. Then there was a need for reimporting Maven projects to have the IDE aware of Maven model changes. I'm not sure how mature is Eclipse support for Maven nowadays though.

这篇关于使用外部依赖项在Git中切换分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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