window下安裝步驟以下:java
一、在IDEA的plugins插件庫中,找到mybatis plugin,而後點擊安裝,重啓idea;bash
二、因爲mybatis plugins 是收費的插件,咱們須要經過破解來使用它;mybatis
破解步驟以下:ide
1)將C:\Users\Administrator\.IntelliJIdea15\config\plugins\mybatis_plus\lib\mybatis_plus.jar找到;idea
2)下載插件
3)隨便新增一個java工程,導入以上兩個jar包,而後寫一個Main類,代碼以下code
import javassist.CannotCompileException; import javassist.ClassPool; import javassist.CtClass; import javassist.CtMethod; import java.io.IOException; /** * Created by Administrator on 2016/11/25. */ public class Main { public static void main(String[] args) throws Exception{ ClassPool pool = ClassPool.getDefault(); CtClass driverClass = pool.get("com.seventh7.mybatis.ref.license.ActivationDriver"); CtClass javaUtil = pool.get("com.seventh7.mybatis.util.JavaUtils"); CtMethod activate = driverClass.getMethod("activate", "(Ljava/lang/String;)Lcom/seventh7/mybatis/ref/license/ActivationResult;"); CtMethod refValid = javaUtil.getDeclaredMethod("refValid"); try { refValid.setBody("{return true;}"); } catch (CannotCompileException e) { e.printStackTrace(); } System.out.println(activate); try { activate.setBody("{com.seventh7.mybatis.ref.license.LicenseData licenseData = new com.seventh7.mybatis.ref.license.LicenseData(\"1\", \"2\");com.seventh7.mybatis.ref.license.ActivationResult res =com.seventh7.mybatis.ref.license.ActivationResult.success(licenseData); return res;}"); } catch (CannotCompileException e) { e.printStackTrace(); } try { driverClass.writeFile("hello"); javaUtil.writeFile("hello"); } catch (CannotCompileException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
在當前工程下會生成一個hello文件夾,將文件夾中的com文件夾拷貝出來, 將com文件夾和mybatis_plus.jar文件夾放到一個目錄,執行get
jar uvf mybatis_plus.jar com
這樣就將com中的ActivationDriver.class和JavaUtils.class,覆蓋至mybatis_plus.jar中了,將修改後的mybatis_plus.jar覆蓋至C:\Users\Administrator\.IntelliJIdea15\config\plugins\mybatis_plus\lib,重啓IDEA,這樣就完成了插件的破解it