为了方便文档的管理,最近装了Atlassian的Confluence,虽说是开源项目,但是仍需购买License才能长久使用,好奇心起,在网上搜索了一下破解之法,发现大多写得模棱两可,害人不浅,最后几经折腾终于破解成功。为了给后来人提供一点儿方便,发扬互联网共享之精神,决定整理一下,破解过程如下:
1) 首先在官方网站上下载并安装了JIRA和confluence:
atlassian-jira-enterprise-3.6.5-standalone.tar.gz
confluence-2.2.10.tar.gz
2) 启动后,可以看到页面下面有一条醒目的红色提醒,说明是Evaluation版本,用admin登录在License Details页面输入官方提供的试用版的License number(可在网站上得到),此时可以正常使用了。
3) 解压confluence-2.2.10.tar.gz包,反编译下列几个文件:
confluence-2.2.10confluenceWEB-INFclassescomatlassianconfluenceupgradeimplDefaultUpgradeManager.class(c1)
confluence-2.2.10confluenceWEB-INFlibatlassian-extras-0.7.20.jar(j1)中的:
atlassian-extras-0.7.20comatlassianlicenseDefaultLicense.class(c2)
atlassian-extras-0.7.20comatlassianlicenseLicenseManager.class(c3)
atlassian-extras-0.7.20comatlassianlicenseLicenseUtils.class(c4)
4) 分别得到的四个Java文件,修改其中与Expire、License等有关的方法,然后再编译得到相应的class,分别替换原来的class,然后将(c1)和(j1)拷贝到安装目录的相应位置下(替换之前最好原文件先备份)。
5) 重启服务,红色提醒不见了,登陆进去,可看到License Details页面信息更新如下:
Organisation | KFC |
Date Purchased | Feb 10, 3906 |
License Type | Confluence: Commercial Server |
Licensed Users | Unlimited |
Support Period | Your commercial Confluence support and updates are available until Oct 10, 3911. |
License ID | (Atlassian sales or support may ask you to provide this ID) |
License Partner | Cocacola |
附: 上述反编译的几个文件修改之处如下(只陈列了修改的部分):
(c1):
public boolean isUpgradeAllowed()
{
return true;
}
(c2):
public boolean isExpired()
{
return false;
}
public Date getExpiryDate()
{
return null;
}
(c3):
private static final Category log = Category.getInstance("com/atlassian/license/LicenseManager");
public boolean hasValidLicense(String licenseKey)
{
return true;
}
public License getLicense(String applicationName)
{
Date dateCreated = new Date(2007, 1, 10);
Date datePurchased = new Date(2006, 1, 10);
License license = new DefaultLicense(dateCreated, datePurchased, "KFC", ConfluenceLicenseTypeStore.FULL_LICENSE, 10000, "Cocacola");
return license;
}
public License setLicense(String license, String applicationName)
{
return null;
}
public LicensePair getLicensePair(String applicationName)
{
return null;
}
(c4):
public static long getSupportPeriodEnd(License license)
{
return (new Date(2010, 9, 9)).getTime() + 0x75cd78800L;
}
public static boolean isLicenseTooOldForBuild(License license, Date buildDate)
{
return false;
}
public static boolean confirmExtendLicenseExpired(Date dateConfirmed)
{
return false;
}
public static boolean confirmExtendLicenseExpired(String dateConfirmed)
throws NumberFormatException
{
return false;
}
private static long getNewBuildWithOldLicenseExpiryDate(Date dateConfirmed)
{
return dateConfirmed.getTime() + 0x9a7ec800L;
}
public static long getNewBuildWithOldLicenseExpiryDate(String dateConfirmed)
{
return getNewBuildWithOldLicenseExpiryDate(new Date(Long.parseLong(dateConfirmed)));
}
public static long getSupportPeriodAlmostExpiredDate(License license)
{
return getSupportPeriodEnd(license) – 0xd84b1800L;
}
特别声明:本文仅供个人爱好和学习使用,请勿用于商业用途,如有必要,请购买正版。
#end