Java项目部署运行后,如果怀疑某个类的修改没有生效,一般可以重新打包,但是使用流水线后一般也需要几分钟,要么就把jar包下载到被动,用IDE打开类来确认,但是这些方法一般都需要一些时间。所以本文介绍jd-cli工具,可以直接在服务器上反编译类
jd-cli依赖的是著名的JD-Core
下载地址
https://github.com/kwart/jd-cli/releases/tag/jd-cli-1.2.0
用法示例
➜ proxy java -jar jd-cli.jar target/classes/com/tenmao/proxy/BaiduApi.class
23:37:58.721 INFO com.github.kwart.jd.cli.Main - Decompiling target/classes/com/tenmao/proxy/BaiduApi.class
package target.classes.com.tenmao.proxy;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
@FeignClient(value = "baidu", path = "/")
public interface BaiduApi {
@GetMapping({"/index.html"})
String index();
}
参考
- [https://github.com/kwart/jd-cli](jd-cli - Command line Java Decompiler)
- [https://github.com/java-decompiler](Java Decompiler)
网友评论