JRebel使用教程
JRebel是开发者用于热部署的插件,也就是修改了Java文件后不需要重新启动Tomcat,修改的代码同样可以生效。
JRebel官方简明教程在这https://zeroturnaround.com/software/jrebel/quickstart/intellij/
JRebel破解可使用授权服务器破解,方法请看http://idea.lanyus.com/
下面开始讲解如何在idea 15中使用JRebel实现热部署:
JRebel是开发者用于热部署的插件,也就是修改了Java文件后不需要重新启动Tomcat,修改的代码同样可以生效。
JRebel官方简明教程在这https://zeroturnaround.com/software/jrebel/quickstart/intellij/
JRebel破解可使用授权服务器破解,方法请看http://idea.lanyus.com/
下面开始讲解如何在idea 15中使用JRebel实现热部署:
修改mybatis generator core,提高对mysql的兼容性
想用ssm框架写个博客系统练手,采用的数据库结构是typecho的。
在typecho_users表中字段名出现了name、group等关键字,使用mybatis_plus_2.531生成xml文件后,发现操作数据库时会报错。
联想以前写php程序时,表名、字段名都用`引起来,测试发现引起来可以操作数据库。
每次手工添加`比较麻烦,修改了mybatis_plus_2.531中的mybatis generator core,让每次生成的xml文件中自动把字段名用`引起来。
2.53版代码变化不大
更新日志如下:
2.52(2.53)
Register mapper as spring bean
Generating generatedKey for number only2.5
Update mybatis generator configuration
Auto generate <generatedKey/> tag for single primary key according to
datasource
Adapt to IntelliJ IDEA 15
Many bugs fixed2.4
Reference sql parameter to related elements
New friendly way to show popup menu
New friendly way to choose folder when generating mapper xml
Support generating statement while existing multi mapper xml with same
namespace
Add a template for the configuration file of mybatis generator to make
it mush easier to create a new configuration file
Support smart completion for the configuration file of mybatis
generator to make it much easier to edit Run mybatis generator in
IntelliJ IDEA [Right click on a generator configuration file, then run
as 'Mybatis Generator']
Associate related elements of mybatis configuration file to make them
working better together Support template of mybatis configuration file
破解过程和前面的一样
我测试了4台电脑,3台装上能正常使用,1台不能用,原因未知(不能使用的那台使用2.531,成功)
下载地址:
2.53: http://download.csdn.net/detail/lanyu19950216/9278935
2.531: http://download.csdn.net/detail/lanyu19950216/9284141
rover12421大牛发了个idea 15的破解补丁出来,这里分享下
http://pan.baidu.com/s/1hq0fKck
http://download.csdn.net/detail/lanyu19950216/9254969
1、复制JetbrainsCrack.jar 到 ${InstallDir}/bin
2、编辑 "${product}${64}.vmoptions" 文件. 添加一行 "-javaagent:JetbrainsCrack.jar"
"${product}${64}.vmoptions" 文件可能是 "clion64.vmoptions","idea.vmoptions","idea64.vmoptions" 等
3、运行
4、使用这个key注册
ThisCrackLicenseId-{
"licenseId":"ThisCrackLicenseId",
"licenseeName":"Rover12421",
"assigneeName":"",
"assigneeEmail":"[email protected]",
"licenseRestriction":"For Rover12421 Crack, Only Test! Please support genuine!!!",
"checkConcurrentUse":false,
"products":[
{"code":"II","paidUpTo":"2099-12-31"},
{"code":"DM","paidUpTo":"2099-12-31"},
{"code":"AC","paidUpTo":"2099-12-31"},
{"code":"RS0","paidUpTo":"2099-12-31"},
{"code":"WS","paidUpTo":"2099-12-31"},
{"code":"DPN","paidUpTo":"2099-12-31"},
{"code":"RC","paidUpTo":"2099-12-31"},
{"code":"PS","paidUpTo":"2099-12-31"},
{"code":"DC","paidUpTo":"2099-12-31"},
{"code":"RM","paidUpTo":"2099-12-31"},
{"code":"CL","paidUpTo":"2099-12-31"},
{"code":"PC","paidUpTo":"2099-12-31"}
],
"hash":"2911276/0",
"gracePeriodDays":7,
"autoProlongated":false}
如果提示Error opening zip file 或者 JAR manifest missing : JetbrainsCrack.jar
编辑javaagent : -javaagent:JetbrainsCrack.jar
修改jar路径为绝对路径:
-javaagent:${InstallDir}/bin/JetbrainsCrack.jar
或者
进入 ${InstallDir}/bin
运行 idea.sh
或者 clion.sh
或者 idea.bat
等
ps:
我这里测试失败,不知道为啥
也可以使用http://15.idea.lanyus.com来破解
ps:
新版本测试成功
需要修改的是2个文件
mybatis_plus.jarcomseventh7mybatisserviceJavaService.class
和
mybatis_plus.jarcomseventh7mybatisutilJavaUtils.class
JavaUtils.class
原来的
package com.seventh7.mybatis.util;
import com.google.common.base.Optional;
import com.google.common.collect.Lists;
import com.intellij.openapi.application.ApplicationInfo;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.psi.JavaPsiFacade;
import com.intellij.psi.PsiAnnotation;
import com.intellij.psi.PsiAnnotationMemberValue;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiImportList;
import com.intellij.psi.PsiImportStatement;
import com.intellij.psi.PsiJavaFile;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.PsiModifierList;
import com.intellij.psi.PsiModifierListOwner;
import com.intellij.psi.PsiParameter;
import com.intellij.psi.PsiParameterList;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.util.PsiTreeUtil;
import com.seventh7.mybatis.annotation.Annotation;
import com.seventh7.mybatis.dom.model.IdDomElement;
import com.seventh7.mybatis.generate0.converter.Utils.MLicenseValidator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;
import net.nicholaswilliams.java.licensing.License;
import net.nicholaswilliams.java.licensing.LicenseManager;
import net.nicholaswilliams.java.licensing.LicenseManagerProperties;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public final class JavaUtils
{
private JavaUtils()
{
throw new UnsupportedOperationException();
}
public static boolean isModelClazz(@Nullable PsiClass clazz)
{
return (null != clazz) && (!clazz.isAnnotationType()) && (!clazz.isInterface()) && (!clazz.isEnum()) && (clazz.isValid());
}
public static boolean isElementWithinInterface(@Nullable PsiElement element)
{
if (((element instanceof PsiClass)) && (((PsiClass)element).isInterface())) {
return true;
}
PsiClass type = (PsiClass)PsiTreeUtil.getParentOfType(element, PsiClass.class);
return (type != null) && (type.isInterface());
}
public static List<PsiMethod> findAllMethodsWithoutRootParent(@NotNull PsiClass clazz)
{
if (clazz == null) {
throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", new Object[] { "clazz", "com/seventh7/mybatis/util/JavaUtils", "findAllMethodsWithoutRootParent" }));
}
Optional<PsiClass> objClazzOpt = findClazz(clazz.getProject(), "java.lang.Object");
if (!objClazzOpt.isPresent()) {
return Collections.emptyList();
}
PsiClass objClazz = (PsiClass)objClazzOpt.get();
PsiMethod[] methods = clazz.getAllMethods();
ArrayList<PsiMethod> res = Lists.newArrayList();
for (int i = 0; i < methods.length; i++) {
if (objClazz.findMethodsByName(methods[i].getName(), false).length == 0) {
res.add(methods[i]);
}
}
return res;
}
@NotNull
public static Optional<PsiClass> findClazz(@NotNull Project project, @Nullable String clazzName)
{
if (project == null) {
throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", new Object[] { "project", "com/seventh7/mybatis/util/JavaUtils", "findClazz" }));
}
Optional tmp65_62 = (clazzName == null ? Optional.absent() : Optional.fromNullable(JavaPsiFacade.getInstance(project).findClass(clazzName, GlobalSearchScope.allScope(project))));
if (tmp65_62 == null) {
throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "com/seventh7/mybatis/util/JavaUtils", "findClazz" }));
}
return tmp65_62;
}
@NotNull
public static Optional<PsiMethod> findMethod(@NotNull Project project, @Nullable String clazzName, @Nullable String methodName)
{
if (project == null) {
throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", new Object[] { "project", "com/seventh7/mybatis/util/JavaUtils", "findMethod" }));
}
if ((StringUtils.isBlank(clazzName)) && (StringUtils.isBlank(methodName)))
{
Optional tmp57_54 = Optional.absent();
if (tmp57_54 == null) {
throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "com/seventh7/mybatis/util/JavaUtils", "findMethod" }));
}
return tmp57_54;
}
Optional<PsiClass> clazz = findClazz(project, clazzName);
if (clazz.isPresent())
{
PsiMethod[] methods = ((PsiClass)clazz.get()).findMethodsByName(methodName, true); Optional
tmp142_139 = (ArrayUtils.isEmpty(methods) ? Optional.absent() : Optional.of(methods[0]));
if (tmp142_139 == null) {
throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "com/seventh7/mybatis/util/JavaUtils", "findMethod" }));
}
return tmp142_139;
}
Optional tmp180_177 = Optional.absent();
if (tmp180_177 == null) {
throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "com/seventh7/mybatis/util/JavaUtils", "findMethod" }));
}
return tmp180_177;
}
@NotNull
public static Optional<PsiMethod> findMethod(@NotNull Project project, @NotNull IdDomElement element)
{
if (project == null) {
throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", new Object[] { "project", "com/seventh7/mybatis/util/JavaUtils", "findMethod" }));
}
if (element == null) {
throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", new Object[] { "element", "com/seventh7/mybatis/util/JavaUtils", "findMethod" }));
}
Optional tmp92_89 = findMethod(project, MapperUtils.getNamespace(element), MapperUtils.getId(element));
if (tmp92_89 == null) {
throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "com/seventh7/mybatis/util/JavaUtils", "findMethod" }));
}
return tmp92_89;
}
public static boolean isAnnotationPresent(@NotNull PsiModifierListOwner target, @NotNull Annotation annotation)
{
if (target == null) {
throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", new Object[] { "target", "com/seventh7/mybatis/util/JavaUtils", "isAnnotationPresent" }));
}
if (annotation == null) {
throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", new Object[] { "annotation", "com/seventh7/mybatis/util/JavaUtils", "isAnnotationPresent" }));
}
PsiModifierList modifierList = target.getModifierList();
return (null != modifierList) && (null != modifierList.findAnnotation(annotation.getQualifiedName()));
}
@NotNull
public static Optional<PsiAnnotation> getPsiAnnotation(@NotNull PsiModifierListOwner target, @NotNull Annotation annotation)
{
if (target == null) {
throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", new Object[] { "target", "com/seventh7/mybatis/util/JavaUtils", "getPsiAnnotation" }));
}
if (annotation == null) {
throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", new Object[] { "annotation", "com/seventh7/mybatis/util/JavaUtils", "getPsiAnnotation" }));
}
PsiModifierList modifierList = target.getModifierList(); Optional
tmp111_108 = (null == modifierList ? Optional.absent() : Optional.fromNullable(modifierList
.findAnnotation(annotation.getQualifiedName())));
if (tmp111_108 == null) {
throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "com/seventh7/mybatis/util/JavaUtils", "getPsiAnnotation" }));
}
return tmp111_108;
}
@NotNull
public static Optional<PsiAnnotationMemberValue> getAnnotationAttributeValue(@NotNull PsiModifierListOwner target, @NotNull Annotation annotation, @NotNull String attrName)
{
if (target == null) {
throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", new Object[] { "target", "com/seventh7/mybatis/util/JavaUtils", "getAnnotationAttributeValue" }));
}
if (annotation == null) {
throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", new Object[] { "annotation", "com/seventh7/mybatis/util/JavaUtils", "getAnnotationAttributeValue" }));
}
if (attrName == null) {
throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", new Object[] { "attrName", "com/seventh7/mybatis/util/JavaUtils", "getAnnotationAttributeValue" }));
}
if (!isAnnotationPresent(target, annotation))
{
Optional tmp131_128 = Optional.absent();
if (tmp131_128 == null) {
throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "com/seventh7/mybatis/util/JavaUtils", "getAnnotationAttributeValue" }));
}
return tmp131_128;
}
Optional<PsiAnnotation> psiAnnotation = getPsiAnnotation(target, annotation); Optional
tmp201_198 = (psiAnnotation.isPresent() ? Optional.fromNullable(((PsiAnnotation)psiAnnotation.get()).findAttributeValue(attrName)) : Optional.absent());
if (tmp201_198 == null) {
throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "com/seventh7/mybatis/util/JavaUtils", "getAnnotationAttributeValue" }));
}
return tmp201_198;
}
@NotNull
public static Optional<PsiAnnotationMemberValue> getAnnotationValue(@NotNull PsiModifierListOwner target, @NotNull Annotation annotation)
{
if (target == null) {
throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", new Object[] { "target", "com/seventh7/mybatis/util/JavaUtils", "getAnnotationValue" }));
}
if (annotation == null) {
throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", new Object[] { "annotation", "com/seventh7/mybatis/util/JavaUtils", "getAnnotationValue" }));
}
Optional tmp90_87 = getAnnotationAttributeValue(target, annotation, "value");
if (tmp90_87 == null) {
throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "com/seventh7/mybatis/util/JavaUtils", "getAnnotationValue" }));
}
return tmp90_87;
}
public static Optional<String> getAnnotationValueText(@NotNull PsiModifierListOwner target, @NotNull Annotation annotation)
{
if (target == null) {
throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", new Object[] { "target", "com/seventh7/mybatis/util/JavaUtils", "getAnnotationValueText" }));
}
if (annotation == null) {
throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", new Object[] { "annotation", "com/seventh7/mybatis/util/JavaUtils", "getAnnotationValueText" }));
}
Optional<PsiAnnotationMemberValue> annotationValue = getAnnotationValue(target, annotation);
return annotationValue.isPresent() ? Optional.of(((PsiAnnotationMemberValue)annotationValue.get()).getText().replaceAll("\"", "")) : Optional.absent();
}
public static boolean isAnyAnnotationPresent(@NotNull PsiModifierListOwner target, @NotNull Set<Annotation> annotations)
{
if (target == null) {
throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", new Object[] { "target", "com/seventh7/mybatis/util/JavaUtils", "isAnyAnnotationPresent" }));
}
if (annotations == null) {
throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", new Object[] { "annotations", "com/seventh7/mybatis/util/JavaUtils", "isAnyAnnotationPresent" }));
}
for (Annotation annotation : annotations) {
if (isAnnotationPresent(target, annotation)) {
return true;
}
}
return false;
}
public static boolean isAllParameterWithAnnotation(@NotNull PsiMethod method, @NotNull Annotation annotation)
{
if (method == null) {
throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", new Object[] { "method", "com/seventh7/mybatis/util/JavaUtils", "isAllParameterWithAnnotation" }));
}
if (annotation == null) {
throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", new Object[] { "annotation", "com/seventh7/mybatis/util/JavaUtils", "isAllParameterWithAnnotation" }));
}
PsiParameter[] parameters = method.getParameterList().getParameters();
for (PsiParameter parameter : parameters) {
if (!isAnnotationPresent(parameter, annotation)) {
return false;
}
}
return true;
}
public static boolean hasImportClazz(@NotNull PsiJavaFile file, @Nullable String clazzName)
{
if (file == null) {
throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", new Object[] { "file", "com/seventh7/mybatis/util/JavaUtils", "hasImportClazz" }));
}
PsiImportList importList = file.getImportList();
if ((null == importList) || (clazzName == null)) {
return false;
}
PsiImportStatement[] statements = importList.getImportStatements();
for (PsiImportStatement tmp : statements) {
if ((null != tmp) &&
(tmp.getQualifiedName() != null) &&
(tmp.getQualifiedName().equals(clazzName))) {
return true;
}
}
return false;
}
private static boolean valid = false;
private static boolean validated = false;
public static synchronized boolean refValid()
{
if (!validated)
{
validated = true;
try
{
License license = getLicense();
SystemData systemData = SystemData.getInstance();
String systemMd5 = systemMd5(new String[] { systemData.getCpuId(), systemData
.getMotherboardId(), systemData
.getMacAddress() });
String issuer = license.getIssuer();
valid = (issuer != null) && (issuer.equals(systemMd5)) && (checkSubject(license.getSubject(), systemData));
}
catch (Exception e)
{
valid = false;
}
}
return valid;
}
public static synchronized String systemMd5(String... args)
{
return args[2];
}
private static synchronized boolean checkSubject(String subject, SystemData systemData)
{
if (subject == null) {
return false;
}
String[] texts = subject.split("-");
if (texts.length != 2) {
return false;
}
String[] as1 = texts[0].split("\\.");
String[] as2 = texts[1].split("\\.");
String[] idea = systemData.getIdeaBuiltVersion().split("\\.");
int step = Math.min(Math.min(as1.length, as2.length), idea.length);
for (int i = 0; i < step; i++)
{
int i1 = parseNumber(as1[i]);
int i2 = parseNumber(as2[i]);
int i3 = parseNumber(idea[i]);
if ((i1 == -1) || (i2 == -1) || (i3 == -1)) {
return false;
}
if ((i3 < i1) || (i3 > i2)) {
return false;
}
}
return true;
}
private static synchronized int parseNumber(String input)
{
return NumberUtils.isNumber(input) ? NumberUtils.toInt(input) : (StringUtils.isNotBlank(input)) && (input.trim().equals("*")) ? Integer.MAX_VALUE : -1;
}
public static synchronized boolean refNotValid()
{
return !refValid();
}
public static synchronized License getLicense()
throws Exception
{
License l = (License)LICENSE.get();
if (l != null) {
return l;
}
LicenseManagerProperties.setPublicKeyDataProvider(MapperUtils.publicKeyDataProvider());
LicenseManagerProperties.setPublicKeyPasswordProvider(MapperUtils.passwordProvider());
LicenseManagerProperties.setLicenseProvider(MapperUtils.licenseProvider());
LicenseManagerProperties.setLicenseValidator(new Utils.MLicenseValidator());
LicenseManager licenseManager = LicenseManager.getInstance();
License license = licenseManager.getLicense("Ref");
licenseManager.validateLicense(license);
LICENSE.compareAndSet(null, license);
return license;
}
private static final AtomicReference<License> LICENSE = new AtomicReference();
public static class SystemData
{
private static SystemData instance;
private final String ip;
private final String macAddress;
private final String cpuId;
private final String motherboardId;
private final String ideaBuiltVersion;
private static final String SEP = "|";
public static synchronized SystemData getInstance()
{
if (instance == null) {
instance = new SystemData(NetUtils.getNetIp(), mockMotherboardId(), mockCupId(), mockMotherboardId(), getIdeaVersion());
}
return instance;
}
private SystemData(String ip, String macAddress, String cpuId, String motherboardId, String ideaBuiltVersion)
{
this.ip = ip;
this.macAddress = macAddress;
this.cpuId = cpuId;
this.motherboardId = motherboardId;
this.ideaBuiltVersion = ideaBuiltVersion;
}
public String getIp()
{
return this.ip;
}
public String getMacAddress()
{
return this.macAddress;
}
public String getCpuId()
{
return this.cpuId;
}
public String getMotherboardId()
{
return this.motherboardId;
}
public String getIdeaBuiltVersion()
{
return this.ideaBuiltVersion;
}
private static String mockMotherboardId()
{
StringBuilder buf = new StringBuilder();
buf.append("is32Bit:").append(SystemInfo.is32Bit).append("|");
buf.append("is64Bit:").append(SystemInfo.is64Bit).append("|");
buf.append("isAMD64:").append(SystemInfo.isAMD64).append("|");
buf.append("isMac:").append(SystemInfo.isMac).append("|");
buf.append("isWindows:").append(SystemInfo.isWindows).append("|");
buf.append("isFreeBSD:").append(SystemInfo.isFreeBSD).append("|");
buf.append("isUnix:").append(SystemInfo.isUnix).append("|");
buf.append("isMacIntel64:").append(SystemInfo.isMacIntel64).append("|");
buf.append("isWin7OrNewer:").append(SystemInfo.isWin7OrNewer).append("|");
buf.append("isFileSystemCaseSensitive:").append(SystemInfo.isFileSystemCaseSensitive).append("|");
buf.append("isAppleJvm:").append(SystemInfo.isAppleJvm).append("|");
buf.append("isOracleJvm:").append(SystemInfo.isOracleJvm).append("|");
buf.append("isSunJvm:").append(SystemInfo.isSunJvm).append("|");
buf.append("isJetbrainsJvm:").append(SystemInfo.isJetbrainsJvm).append("|");
buf.append("isFileSystemCaseSensitive:").append(SystemInfo.isAppleJvm).append("|");
buf.append("osName:").append(SystemInfo.OS_NAME).append("|");
buf.append("osArch:").append(SystemInfo.OS_ARCH).append("|");
buf.append("userHome:").append(System.getProperty("user.home")).append("|");
buf.append("userName:").append(System.getProperty("user.name")).append("|");
buf.append("areSymLinksSupported:").append(SystemInfo.areSymLinksSupported);
return buf.toString();
}
private static String getIdeaVersion()
{
return ApplicationInfo.getInstance().getFullVersion();
}
private static String mockCupId()
{
return SystemInfo.OS_NAME;
}
}
}