栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

Generator生成代码 时 ClassNotFoundException: freemarker.template.Configuration

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Generator生成代码 时 ClassNotFoundException: freemarker.template.Configuration

public class FastAutoGeneratorDemo {

public static void main(String[] args) {

    System.out.println(System.getProperty("user.dir"));
    FastAutoGenerator.create("jdbc:mysql://127.0.0.1:3306/mybatis_plus?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai",
            "root", "123456")
            .globalConfig(builder -> {
                builder.author("baomidou") // 设置作者
                       // .enableSwagger() // 开启 swagger 模式  需要导入swagger的包
                        .fileOverride() // 覆盖已生成文件
                        .outputDir(System.getProperty("user.dir")+"/rabbitproduce/src/main/java"); // 指定输出目录
            })
            .packageConfig(builder -> {
                builder.parent("com.baomidou.mybatisplus") // 设置父包名
                        .moduleName("system") // 设置父包模块名
                        .pathInfo(Collections.singletonMap(OutputFile.mapperXml, System.getProperty("user.dir")+"/rabbitproduce/src/main/resources/mapper")); // 设置mapperXml生成路径
            })
            .strategyConfig(builder -> {
                builder.addInclude("user") // 设置需要生成的表名
                        .addTablePrefix("t_", "c_"); // 设置过滤表前缀
            })
            .templateEngine(new FreemarkerTemplateEngine()) // 使用Freemarker引擎模板,默认的是Velocity引擎模板
            .execute();
}

}

报错
16:40:47.542 [main] DEBUG com.baomidou.mybatisplus.generator.AutoGenerator - 准备生成文件…
Exception in thread “main” java.lang.NoClassDefFoundError: freemarker/template/Configuration
at com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine.init(FreemarkerTemplateEngine.java:41)
at com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine.init(FreemarkerTemplateEngine.java:36)
at com.baomidou.mybatisplus.generator.AutoGenerator.execute(AutoGenerator.java:179)
at com.baomidou.mybatisplus.generator.FastAutoGenerator.execute(FastAutoGenerator.java:213)
at com.mq.rabbitproduce.FastAutoGeneratorDemo.main(FastAutoGeneratorDemo.java:35)
Caused by: java.lang.ClassNotFoundException: freemarker.template.Configuration
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:636)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
… 5 more

	导入freemarker

	
		org.freemarker
		freemarker
		2.3.28
		compile
	
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/632455.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号