我是靠谱客的博主 缥缈冬日,这篇文章主要介绍SpringBoot异常:IDEA+SpringBoot+Mybatis使用generatorConfig.xml生成xml,Maven打包异常,现在分享给大家,希望可以做个参考。

IDEA+SpringBoot+Mybatis项目,使用generatorConfig.xml生成xml

在Maven打包的时候出现异常

在maven package打包时,竟然运行了generatorConfig.xml,把已经修改的java类和xml原件覆盖掉了,导致问题出现了


解决办法我是把generatorConfig.xml的table配置改为如下:

复制代码
1
2
3
4
<!-- 相关表的配置 --> <table tableName="****" enableCountByExample="false" enableDeleteByExample="false" enableSelectByExample="false" enableUpdateByExample="false"/>

————————更新——————————

上述方法是错误的!!!

打包是成功了,但是执行jar的时候出现问题了。。。。。提示 unable to start.....container

再回到IDEA编译项目,发现也出现这个问题,代表上面那样改是不正确的,于是就想不让mvn package打包的时候执行mybatis-generator插件,就找到如下方法,最终配置如下:

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<build> <resources> <resource> <directory>src/main/java</directory> <!--配置此项是为了让maven搬运Java目录下的xml文件,默认是不搬运java目录下的xml文件--> <includes> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> <!--让maven不搬运的文件和目录--> <resource> <directory>src/main/resources</directory> <excludes> <exclude>mybatis/generatorConfig.xml</exclude> <exclude>db/*</exclude> </excludes> </resource> </resources> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>1.3.2</version> <configuration> <!--配置文件的位置--> <configurationFile>src/main/resources/mybatis/generatorConfig.xml</configurationFile> <verbose>true</verbose> <overwrite>true</overwrite> </configuration> <executions> <execution> <id>Generate MyBatis Artifacts</id> <phase>deploy</phase><!--解决mvn package打包的时候执行了mybatis-generator-maven-plugin导致无法打包问题--> <goals> <goal>generate</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-core</artifactId> <version>1.3.2</version> </dependency> </dependencies> </plugin> </plugins> </build>


最后

以上就是缥缈冬日最近收集整理的关于SpringBoot异常:IDEA+SpringBoot+Mybatis使用generatorConfig.xml生成xml,Maven打包异常的全部内容,更多相关SpringBoot异常:IDEA+SpringBoot+Mybatis使用generatorConfig内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(64)

评论列表共有 0 条评论

立即
投稿
返回
顶部