abel533 / Mapper

Mybatis Common Mapper - Easy to use
https://mybatis.io
MIT License
7.34k stars 1.63k forks source link

配合MyBatis Generator Maven Plugin 1.4.0报错 #728

Open wkii opened 4 years ago

wkii commented 4 years ago

实测目前最多支持到1.3.7。 但扔需反馈一个bug。

使用以下插件配置后

<plugin type="tk.mybatis.mapper.generator.MapperPlugin">
        <property name="mappers" value="com.mydomain.asdao.mapper.BaseMapper"/>
        <property name="caseSensitive" value="true"/>
</plugin>

配合 MyBatis Generator Maven Plugin 1.4.0的时候会报以下错误:

[ERROR] Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.4.0:generate (default-cli) on project as-dao: Execution default-cli of goal org.mybatis.generator:mybatis-generator-maven-plugin:1.4.0:generate failed: A required class was missing while executing org.mybatis.generator:mybatis-generator-maven-plugin:1.4.0:generate: org/mybatis/generator/api/dom/xml/Element
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.mybatis.generator:mybatis-generator-maven-plugin:1.4.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/myname/.m2/repository/org/mybatis/generator/mybatis-generator-maven-plugin/1.4.0/mybatis-generator-maven-plugin-1.4.0.jar
[ERROR] urls[1] = file:/Users/myname/.m2/repository/mysql/mysql-connector-java/8.0.19/mysql-connector-java-8.0.19.jar
[ERROR] urls[2] = file:/Users/myname/.m2/repository/com/google/protobuf/protobuf-java/3.6.1/protobuf-java-3.6.1.jar
[ERROR] urls[3] = file:/Users/myname/.m2/repository/tk/mybatis/mapper-generator/1.1.5/mapper-generator-1.1.5.jar
[ERROR] urls[4] = file:/Users/myname/.m2/repository/org/apache/commons/commons-lang3/3.8.1/commons-lang3-3.8.1.jar
[ERROR] urls[5] = file:/Users/myname/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar
[ERROR] urls[6] = file:/Users/myname/.m2/repository/org/eclipse/sisu/org.eclipse.sisu.inject/0.3.3/org.eclipse.sisu.inject-0.3.3.jar
[ERROR] urls[7] = file:/Users/myname/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[8] = file:/Users/myname/.m2/repository/org/codehaus/plexus/plexus-utils/3.2.1/plexus-utils-3.2.1.jar
[ERROR] urls[9] = file:/Users/myname/.m2/repository/org/mybatis/generator/mybatis-generator-core/1.4.0/mybatis-generator-core-1.4.0.jar
[ERROR] urls[10] = file:/Users/myname/.m2/repository/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------
[ERROR] : org.mybatis.generator.api.dom.xml.Element
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
abel533 commented 4 years ago

目前高版本有什么特别的地方吗?

hongdaDu commented 4 years ago

mark

hongdaDu commented 4 years ago

高版本支持jdk8的日期类型,LocalDateTime 等

DrunkLiu commented 4 years ago

1.3.7也有问题

DrunkLiu commented 4 years ago

java.lang.VerifyError: Bad type on operand stack Exception Details: Location: tk/mybatis/mapper/generator/MapperCommentGenerator.addComment(Lorg/mybatis/generator/api/dom/xml/XmlElement;)V @10: invokevirtual Reason: Type 'org/mybatis/generator/api/dom/xml/TextElement' (current frame, stack[1]) is not assignable to 'org/mybatis/generator/api/dom/xml/Element' Current Frame: bci: @10 flags: { } locals: { 'tk/mybatis/mapper/generator/MapperCommentGenerator', 'org/mybatis/generator/api/dom/xml/XmlElement' } stack: { 'org/mybatis/generator/api/dom/xml/XmlElement', 'org/mybatis/generator/api/dom/xml/TextElement' } Bytecode: 0x0000000: 2bbb 0005 5912 06b7 0007 b600 08bb 0009 0x0000010: 59b7 000a 4d2c 120b b600 0c57 2c12 0eb6 0x0000020: 000c 572b bb00 0559 2cb6 000f b700 07b6 0x0000030: 0008 2bbb 0005 5912 10b7 0007 b600 08b1 0x0000040:

java.lang.VerifyError: Bad type on operand stack Exception Details: Location: tk/mybatis/mapper/generator/MapperCommentGenerator.addComment(Lorg/mybatis/generator/api/dom/xml/XmlElement;)V @10: invokevirtual Reason: Type 'org/mybatis/generator/api/dom/xml/TextElement' (current frame, stack[1]) is not assignable to 'org/mybatis/generator/api/dom/xml/Element' Current Frame: bci: @10 flags: { } locals: { 'tk/mybatis/mapper/generator/MapperCommentGenerator', 'org/mybatis/generator/api/dom/xml/XmlElement' } stack: { 'org/mybatis/generator/api/dom/xml/XmlElement', 'org/mybatis/generator/api/dom/xml/TextElement' } Bytecode: 0x0000000: 2bbb 0005 5912 06b7 0007 b600 08bb 0009 0x0000010: 59b7 000a 4d2c 120b b600 0c57 2c12 0eb6 0x0000020: 000c 572b bb00 0559 2cb6 000f b700 07b6 0x0000030: 0008 2bbb 0005 5912 10b7 0007 b600 08b1 0x0000040:

DesenYang commented 3 years ago

[INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.322 s [INFO] Finished at: 2021-01-31T09:38:02+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.7:generate (default-cli) on project mall-db: Execution default-cli of goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.7:generate failed: A required class was missing while executing org.mybatis.generator:mybatis-generator-maven-plugin:1.3.7:generate: org/dom4j/io/SAXReader [ERROR] ----------------------------------------------------- [ERROR] realm = plugin>org.mybatis.generator:mybatis-generator-maven-plugin:1.3.7 [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy [ERROR] urls[0] = file:/Users/yourname/.m2/repository/org/mybatis/generator/mybatis-generator-maven-plugin/1.3.7/mybatis-generator-maven-plugin-1.3.7.jar [ERROR] urls[1] = file:/Users/yourname/.m2/repository/mysql/mysql-connector-java/5.1.46/mysql-connector-java-5.1.46.jar [ERROR] urls[2] = file:/Users/yourname/.m2/repository/com/itfsw/mybatis-generator-plugin/1.2.12/mybatis-generator-plugin-1.2.12.jar [ERROR] urls[3] = file:/Users/yourname/.m2/repository/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar [ERROR] urls[4] = file:/Users/yourname/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar [ERROR] urls[5] = file:/Users/yourname/.m2/repository/org/eclipse/sisu/org.eclipse.sisu.inject/0.3.3/org.eclipse.sisu.inject-0.3.3.jar [ERROR] urls[6] = file:/Users/yourname/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar [ERROR] urls[7] = file:/Users/yourname/.m2/repository/org/codehaus/plexus/plexus-utils/3.1.0/plexus-utils-3.1.0.jar [ERROR] urls[8] = file:/Users/yourname/.m2/repository/org/mybatis/generator/mybatis-generator-core/1.3.7/mybatis-generator-core-1.3.7.jar [ERROR] Number of foreign imports: 1 [ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]] [ERROR] [ERROR] ----------------------------------------------------- [ERROR] : org.dom4j.io.SAXReader [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException

  <plugin>
            <groupId>org.mybatis.generator</groupId>
            <artifactId>mybatis-generator-maven-plugin</artifactId>
            <version>1.3.7</version>
            <configuration>
                <configurationFile>
                    mybatis-generator/generatorConfig.xml
                </configurationFile>
                <overwrite>true</overwrite>
                <verbose>true</verbose>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>mysql</groupId>
                    <artifactId>mysql-connector-java</artifactId>
                    <version>5.1.46</version>
                </dependency>
                <dependency>
                    <groupId>com.itfsw</groupId>
                    <artifactId>mybatis-generator-plugin</artifactId>
                    <version>1.2.12</version>
                </dependency>
            </dependencies>
        </plugin>
bestwxc commented 2 years ago

java.lang.VerifyError: Bad type on operand stack Exception Details: Location: tk/mybatis/mapper/generator/MapperCommentGenerator.addComment(Lorg/mybatis/generator/api/dom/xml/XmlElement;)V @10: invokevirtual Reason: Type 'org/mybatis/generator/api/dom/xml/TextElement' (current frame, stack[1]) is not assignable to 'org/mybatis/generator/api/dom/xml/Element' Current Frame: bci: @10 flags: { } locals: { 'tk/mybatis/mapper/generator/MapperCommentGenerator', 'org/mybatis/generator/api/dom/xml/XmlElement' } stack: { 'org/mybatis/generator/api/dom/xml/XmlElement', 'org/mybatis/generator/api/dom/xml/TextElement' } Bytecode: 0x0000000: 2bbb 0005 5912 06b7 0007 b600 08bb 0009 0x0000010: 59b7 000a 4d2c 120b b600 0c57 2c12 0eb6 0x0000020: 000c 572b bb00 0559 2cb6 000f b700 07b6 0x0000030: 0008 2bbb 0005 5912 10b7 0007 b600 08b1 0x0000040:

java.lang.VerifyError: Bad type on operand stack Exception Details: Location: tk/mybatis/mapper/generator/MapperCommentGenerator.addComment(Lorg/mybatis/generator/api/dom/xml/XmlElement;)V @10: invokevirtual Reason: Type 'org/mybatis/generator/api/dom/xml/TextElement' (current frame, stack[1]) is not assignable to 'org/mybatis/generator/api/dom/xml/Element' Current Frame: bci: @10 flags: { } locals: { 'tk/mybatis/mapper/generator/MapperCommentGenerator', 'org/mybatis/generator/api/dom/xml/XmlElement' } stack: { 'org/mybatis/generator/api/dom/xml/XmlElement', 'org/mybatis/generator/api/dom/xml/TextElement' } Bytecode: 0x0000000: 2bbb 0005 5912 06b7 0007 b600 08bb 0009 0x0000010: 59b7 000a 4d2c 120b b600 0c57 2c12 0eb6 0x0000020: 000c 572b bb00 0559 2cb6 000f b700 07b6 0x0000030: 0008 2bbb 0005 5912 10b7 0007 b600 08b1 0x0000040:

请教一下,这个日志是怎么生成的。