Comments (9)
为什么要放在src/main/java 呢..
from spring-boot-api-project-seed.
我是单独建了一个工具的工程,想把这个单独摘出来的。所以就放在src/main/java下面了
from spring-boot-api-project-seed.
它依赖的模版资源 & 配置都是基于test目录的,你把模板移动到 src/main/resources下应该就可以了
from spring-boot-api-project-seed.
这里
private static final String TEMPLATE_FILE_PATH = PROJECT_PATH + "/src/test/resources/generator/template";//模板位置
这里,scope
去掉
<!--代码生成器依赖-->
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.23</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.3.5</version>
<scope>test</scope>
</dependency>
from spring-boot-api-project-seed.
我这个地方是 src/main/resource 模板文件也是在这个里面。
from spring-boot-api-project-seed.
具体问题是
Exception in thread "main" java.lang.NoClassDefFoundError: freemarker/template/Configuration at com.glad.tools.generator.CodeGenerator1.getConfiguration(CodeGenerator1.java:202) at com.glad.tools.generator.CodeGenerator1.genService(CodeGenerator1.java:146) at com.glad.tools.generator.CodeGenerator1.genCode(CodeGenerator1.java:71) at com.glad.tools.generator.CodeGenerator1.main(CodeGenerator1.java:64) Caused by: java.lang.ClassNotFoundException: freemarker.template.Configuration at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 4 more
这个(src/main/resource 没变化的情况下,CodeGenerator.java 放在src/main/java 下面就会发生上面这样的问题。
好无厘头。。
from spring-boot-api-project-seed.
@zhongqishang Maven 依赖 scope
from spring-boot-api-project-seed.
soga!
from spring-boot-api-project-seed.
好了。3q!
from spring-boot-api-project-seed.
Related Issues (20)
- 建议视频放在B站 HOT 5
- {"code":500,"message":"接口 [/thetrainlist/list/] 内部错误,请联系管理员"} HOT 2
- 为啥我生成了3个文件夹,不是包呢。
- 请问有将springboot升级到2.X计划吗?有的话大概什么时候?
- 根据添加的依赖生成对应的application配置
- 建议把Controller、Service、DAO和和三方对接的模板都写一下
- 验签拦截器获取不到请求头中的数据
- "message": "接口 [/user/add] 内部错误,请联系管理员"
- "message": "接口 [/user/add] 内部错误,请联系管理员"bug已解决 HOT 2
- resource下面没有mapper文件 HOT 3
- 前后端分离项目,vue+boot,针对这个工程里面有需要改动的地方吗?
- 去掉fastjson的依赖吧 HOT 1
- 【招聘向】大厂机会,将这个项目应用到生产吧 HOT 1
- 大神对RESTful 有点误解吧 HOT 6
- 停更了? HOT 1
- 返回的对象是空,是什么原因 HOT 2
- 大佬加个相关项目链接呗 HOT 1
- 【项目自荐】: ❤️一个基于Springboot的个人博客 HOT 1
- 来个 springboot2.x最新版的吧?1.5有些老了?
- 建议
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-boot-api-project-seed.