Java Intellij:更改外部库代码并立即生效 [英] Java Intellij: Make change on external lib code and take effect immediately

查看:91
本文介绍了Java Intellij:更改外部库代码并立即生效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Intellij开发Java.现在,我可以通过将源附加到jar lib来调试我的外部lib代码.但是现在我想对lib的源代码进行更改,并使其立即生效,而无需重新打包为jar并再次包含到我的主项目中.我可以这样做吗?

I am working on Java with Intellij. Now I can debug into my external lib code by attaching source to jar lib. But now I want to make change on lib's source code and make it take effect immediately without repackaging to jar and including again to my main project. Can I do that ?

推荐答案

从概念上讲不是一个好主意.

Not a good idea - conceptually.

这两个都是外部库.那么它的部署伪像就是一个JAR.或者它是一个源项目".

Either something is an external library. Then its deployment artefact is a JAR. Or it is a "source project".

换句话说:您正在尝试吃蛋糕并同时食用.如果您找到了一种可以在此处入侵自己的技术方法-您不应该去那里.因为这在概念上是错误的.

In other words: you are trying to eat the cake and have it at the same time. If it you find a technical way to hack yourself there - you shouldn't go there. Because it is conceptually wrong.

如果问题主要是关于动态地更新正在运行的JVM,则可以使用JRebel之类的工具.但这还要求您的JVM与JRebel代理一起运行(这对于测试/开发系统很好,但是在生产环境中不能使用).

If the question is mainly about dynamically updating a running JVM - for that you can use tools such as JRebel. But that also requires that your JVM is running with the JRebel agent (which is fine for test/dev systems, but a no-go in production environments).

这篇关于Java Intellij:更改外部库代码并立即生效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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