[英]Maintaining patches of third-party Java library dependencies
My Java project has a dependency on a third-party library, let's call it xyz.jar. 我的Java项目依赖第三方库,我们称其为xyz.jar。 My project is maintained in git and xyz in svn. 我的项目在svn中的git和xyz中维护。 xyz is included in my project as a Maven dependency so that it gets downloaded automatically as part of the build process. xyz作为Maven依赖项包含在我的项目中,因此在构建过程中会自动下载xyz。
I need to make minor tweaks to the source of xyz, but still want to get updates from the project maintainers. 我需要对xyz的源代码进行细微调整,但仍想从项目维护者那里获取更新。 What options do I have? 我有什么选择?
Currently, the best option seems to be to this: 当前,最好的选择似乎是这样的:
git svn clone
. 使用git svn clone
xyz的svn repo分叉到新的 git repo中。 When new changes come out for xyz, I can do a git svn rebase
to keep my git repo up to date. 当xyz出现新变化时,我可以执行git svn rebase
来保持git repo处于最新状态。
What are the best practices here? 这里的最佳做法是什么? Can I improve on this approach? 我可以改进这种方法吗?
Edit 编辑
I know there will be some manual work involved, eg resolving merge conflicts and ensuring my patches are compatible with the latest xyz. 我知道将涉及一些手动工作,例如解决合并冲突并确保我的补丁程序与最新的xyz兼容。 I'm not looking for a general, automated code merge solution. 我不是在寻找通用的自动化代码合并解决方案。 I'm trying to find out what the best practices and tools are in this situation. 我正在尝试找出在这种情况下的最佳实践和工具。
Gradle 摇篮
I don't think this is a Gradle-specific question, but just in case there's a Gradle-specific answer: I'm using Gradle to include xyz.jar as a 'compile' dependency. 我不认为这是特定于Gradle的问题,但以防万一有特定于Gradle的答案:我正在使用Gradle将xyz.jar包含为“编译”依赖项。
No matter what approach you use, it will always be labor-intensive. 无论您使用哪种方法,都将总是劳动密集型的。
Explicit conflicts will occur, but more insidious, any change anywhere in the base can totally break your local mods, even a change in a source file your local mods don't touch (ie an interface signature you depend on). 将会发生明确的冲突,但是更隐蔽的是,基础上任何地方的任何更改都可能完全破坏您的本地mod,甚至您本地mod不会触摸的源文件的更改(即您依赖的接口签名)。
Each and every rebase will require manual merging and complete regression testing on the 3rd party library AND your applciations that depend on the library. 每个基准库都需要对第三方库以及依赖该库的应用进行手动合并和完整的回归测试。
By definition, this is not automatable. 根据定义,这不是自动的。
I think you should consider the following points in respect to your approach: 我认为您应该针对您的方法考虑以下几点:
My opinion is that such kind of problems should not be automated anyhow since this happens pretty rare and require your manual intervention anyway. 我的意见是,这类问题无论如何都不应自动解决,因为这种情况很少发生,并且无论如何都需要您的手动干预。 Ie you will spend much more time trying to automate this than in case you parform manual rebuilds, say, once in half-a-year. 也就是说,与每半年进行一次手动重建相比,您将花费更多的时间来尝试实现自动化。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.