今天MyBatis逆向工程执行时报如下错误:
D:\workspaces\sts\.metadata\.plugins\org.mybatis.generator.eclipse.ui\.generatedAntScripts\tempostar-api-mybatis-generator-generatorConfig-savaway.xml.xml:5: java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
net/tempostar/mybatis/generator/plugins/DefaultRegModiDatePlugin.sqlMapUpdateByPrimaryKeySelectiveElementGenerated(Lorg/mybatis/generator/api/dom/xml/XmlElement;Lorg/mybatis/generator/api/IntrospectedTable;)Z @30: invokespecial
Reason:
Type 'org/mybatis/generator/api/dom/xml/XmlElement' (current frame, stack[1]) is not assignable to 'org/mybatis/generator/api/dom/xml/Element'
Current Frame:
bci: @30
flags: { }
locals: { 'net/tempostar/mybatis/generator/plugins/DefaultRegModiDatePlugin', 'org/mybatis/generator/api/dom/xml/XmlElement', 'org/mybatis/generator/api/IntrospectedTable' }
stack: { 'net/tempostar/mybatis/generator/plugins/DefaultRegModiDatePlugin', 'org/mybatis/generator/api/dom/xml/XmlElement', '[Ljava/lang/String;', '[Ljava/lang/String;' }
Bytecode:
0000000: b200 1012 4bb9 0025 0200 2a2b 04bd 002b
0000010: 5903 122d 5304 bd00 2b59 0312 3153 b700
0000020: 3357 2a2b 04bd 002b 5903 1240 53b7 004d
0000030: 2a2b 04bd 002b 5903 1242 53b7 0044 2a2b
0000040: 2cb7 0050 ac
java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
net/tempostar/mybatis/generator/plugins/DefaultRegModiDatePlugin.sqlMapUpdateByPrimaryKeySelectiveElementGenerated(Lorg/mybatis/generator/api/dom/xml/XmlElement;Lorg/mybatis/generator/api/IntrospectedTable;)Z @30: invokespecial
Reason:
Type 'org/mybatis/generator/api/dom/xml/XmlElement' (current frame, stack[1]) is not assignable to 'org/mybatis/generator/api/dom/xml/Element'
Current Frame:
bci: @30
flags: { }
locals: { 'net/tempostar/mybatis/generator/plugins/DefaultRegModiDatePlugin', 'org/mybatis/generator/api/dom/xml/XmlElement', 'org/mybatis/generator/api/IntrospectedTable' }
stack: { 'net/tempostar/mybatis/generator/plugins/DefaultRegModiDatePlugin', 'org/mybatis/generator/api/dom/xml/XmlElement', '[Ljava/lang/String;', '[Ljava/lang/String;' }
Bytecode:
0000000: b200 1012 4bb9 0025 0200 2a2b 04bd 002b
0000010: 5903 122d 5304 bd00 2b59 0312 3153 b700
0000020: 3357 2a2b 04bd 002b 5903 1240 53b7 004d
0000030: 2a2b 04bd 002b 5903 1242 53b7 0044 2a2b
0000040: 2cb7 0050 ac
这都是些什么鬼信息,连机器码都出来了。
后来发现Eclipse安装的mybatis generator插件与gradle集成的插件不兼容。
Eclipse里安装的:
gradle工程里用到的:
将Eclipse的1.4版本插件卸载,安装1.3.7版本的插件后重启Eclipse即可解决。
1.3.7版本插件安装方法:
Eclipse插件mybatis generator 1.3.7安装