1)从class的jar包文件反编译成java的压缩包,我们可以用jd-gui、jad命令、在线反编译等工具。
在这里我使用Decompilers online的在线反编译,反编译完再下载java的zip包就可以了。
2)新建java eclipse工程,复制反编译完的java文件到工程里面。
并导入原来的atlassian-universal-plugin-manager-plugin-2.22.9.jar作为依赖编译
- 修改com.atlassian.extras.decoder.v2.Version2LicenseDecoder.loadLicenseConfiguration(Reader)方法如下:
private Properties loadLicenseConfiguration(Reader text) { Properties props = new Properties(); try { (new DefaultPropertiesPersister()).load(props, text); if (props.containsKey("Description")) { String desc = props.getProperty("Description"); props.put("Description", desc.replace("Evaluation", "Commercial")); if (desc.contains("Confluence")) { props.put("conf.LicenseTypeName", "COMMERCIAL"); } else if (desc.contains("JIRA")) { props.put("jira.LicenseTypeName", "COMMERCIAL"); } else if (desc.contains("FishEye")) { props.put("fisheye.LicenseTypeName", "COMMERCIAL"); } else if (desc.contains("Bitbucket")) { props.put("stash.LicenseTypeName", "COMMERCIAL"); } props.put("Evaluation", false); props.put("MaintenanceExpiryDate", "2099-01-01"); props.put("LicenseExpiryDate", "2099-01-01"); } return props; } catch (IOException var3) { throw new LicenseException("Could NOT load properties from reader",var3); } }
- 修改com.atlassian.license.LicenseManager.hasValidLicense(String)
public boolean hasValidLicense(String licenseKey) { return true; }
3)把编译好的com.atlassian.extras.decoder.v2.Version2LicenseDecoder.class和com.atlassian.license.LicenseManager.class
移值回原来的atlassian-universal-plugin-manager-plugin-2.22.9.jar保证最小修改。(这是微创的,无bug的)
我这里是用winrar直接替换对应的目录的class文件。
4)验证:
试用安装了Google Doc插件,显示是 commercial的许可证。成功了