当前使用版本(必填,否则不予处理)

3.3.2

该问题是如何引起的?(确定最新版也有问题再提!!!)

使用代码生成器运行

重现步骤(如果有就写完整)

生成这个表,会出错

CREATE TABLE `core_user_auth` (
  `id` bigint(20) NOT NULL DEFAULT '0',
  `if_del` tinyint(1) NOT NULL DEFAULT '0',
  `version` int(10) NOT NULL DEFAULT '0',
  `create_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `update_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `user_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '用户id',
  `account` varchar(64) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '登录账号',
  `password` varchar(64) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '登录密码',
  `login_enum` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '登录类型\ncli_pwd 客户端密码登录\ncli_msg 客户端短信登录\n\nserve_pwd 管理端密码登录\nserve_msg 管理端短信登录',
  `auth_login` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT '登录成功后的token',
  PRIMARY KEY (`id`),
  UNIQUE KEY `user_id` (`account`) USING BTREE,
  KEY `if_del` (`if_del`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

报错信息

请输入表名,多个英文逗号分割:
core_user_auth
15:21:08.413 [main] DEBUG com.baomidou.mybatisplus.generator.AutoGenerator - ==========================准备生成文件...==========================
15:21:08.729 [main] WARN org.apache.velocity.deprecation - configuration key 'file.resource.loader.unicode' has been deprecated in favor of 'resource.loader.file.unicode'
15:21:08.730 [main] WARN org.apache.velocity.deprecation - configuration key 'file.resource.loader.class' has been deprecated in favor of 'resource.loader.file.class'
15:21:08.731 [main] DEBUG com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 创建目录: [core/core-dao/src/main/java/com/example/ent/coredao/controller]
15:21:08.732 [main] DEBUG org.apache.velocity - Initializing Velocity, Calling init()...
15:21:08.732 [main] DEBUG org.apache.velocity - Starting Apache Velocity v2.2
15:21:08.735 [main] DEBUG org.apache.velocity - Default Properties resource: org/apache/velocity/runtime/defaults/velocity.properties
15:21:08.746 [main] DEBUG org.apache.velocity - ResourceLoader instantiated: org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
15:21:08.747 [main] DEBUG org.apache.velocity - initialized (class org.apache.velocity.runtime.resource.ResourceCacheImpl) with class java.util.Collections$SynchronizedMap cache map.
15:21:08.748 [main] DEBUG org.apache.velocity - Loaded System Directive: org.apache.velocity.runtime.directive.Stop
15:21:08.749 [main] DEBUG org.apache.velocity - Loaded System Directive: org.apache.velocity.runtime.directive.Define
15:21:08.749 [main] DEBUG org.apache.velocity - Loaded System Directive: org.apache.velocity.runtime.directive.Break
15:21:08.750 [main] DEBUG org.apache.velocity - Loaded System Directive: org.apache.velocity.runtime.directive.Evaluate
15:21:08.750 [main] DEBUG org.apache.velocity - Loaded System Directive: org.apache.velocity.runtime.directive.Macro
15:21:08.751 [main] DEBUG org.apache.velocity - Loaded System Directive: org.apache.velocity.runtime.directive.Parse
15:21:08.751 [main] DEBUG org.apache.velocity - Loaded System Directive: org.apache.velocity.runtime.directive.Include
15:21:08.752 [main] DEBUG org.apache.velocity - Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
15:21:08.772 [main] DEBUG org.apache.velocity.parser - Created '20' parsers.
15:21:08.789 [main] DEBUG org.apache.velocity.macro - "velocimacro.library.path" is not set. Trying default library: velocimacros.vtl
15:21:08.789 [main] DEBUG org.apache.velocity.loader.file - Could not load resource 'velocimacros.vtl' from ResourceLoader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
15:21:08.789 [main] DEBUG org.apache.velocity.macro - Default library velocimacros.vtl not found. Trying old default library: VM_global_library.vm
15:21:08.789 [main] DEBUG org.apache.velocity.loader.file - Could not load resource 'VM_global_library.vm' from ResourceLoader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
15:21:08.789 [main] DEBUG org.apache.velocity.macro - Old default library VM_global_library.vm not found.
15:21:08.789 [main] DEBUG org.apache.velocity.macro - allowInline = true: VMs can be defined inline in templates
15:21:08.789 [main] DEBUG org.apache.velocity.macro - allowInlineToOverride = false: VMs defined inline may NOT replace previous VM definitions
15:21:08.789 [main] DEBUG org.apache.velocity.macro - allowInlineLocal = false: VMs defined inline will be global in scope if allowed.
15:21:08.789 [main] DEBUG org.apache.velocity.macro - autoload off: VM system will not automatically reload global library macros
15:21:08.796 [main] ERROR org.apache.velocity.parser - /templates/mapper.xml.ftl: Encountered "enableCache" at line 5, column 6.
Was expecting one of:
    "(" ...
    <WHITESPACE> ...
    <NEWLINE> ...

15:21:08.797 [main] ERROR org.apache.velocity.loader - ResourceManager: parse exception: Encountered "enableCache" at /templates/mapper.xml.ftl[line 5, column 6]
Was expecting one of:
    "(" ...
    <WHITESPACE> ...
    <NEWLINE> ...

15:21:08.799 [main] ERROR com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine - 无法创建文件,请检查配置信息!
org.apache.velocity.exception.ParseErrorException: Encountered "enableCache" at /templates/mapper.xml.ftl[line 5, column 6]
Was expecting one of:
    "(" ...
    <WHITESPACE> ...
    <NEWLINE> ...

    at org.apache.velocity.Template.process(Template.java:154)
    at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:425)
    at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:342)
    at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1661)
    at org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:334)
    at com.baomidou.mybatisplus.generator.engine.VelocityTemplateEngine.writer(VelocityTemplateEngine.java:65)
    at com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine.batchOutput(AbstractTemplateEngine.java:81)
    at com.baomidou.mybatisplus.generator.AutoGenerator.execute(AutoGenerator.java:106)
    at com.example.ent.coredao.MybatisPlusCodeGenerator.main(MybatisPlusCodeGenerator.java:158)
15:21:08.799 [main] DEBUG com.baomidou.mybatisplus.generator.AutoGenerator - ==========================文件生成完成!!!==========================

Process finished with exit code 0

Comment From: songlongkuan

问题已找到,原因是因为我开启了swagger注解,并且有一个字段的注释存在换行符,所导致的

Comment From: nieqiurong

2498