The method in the custom DAO (xxxMapper) is deleted when the Springboot project runs the MVN command.

the SpringBoot project can run using the Java entry normal class, but when starting by running the Maven command or performing other operations, such as using the Maven command to package the project, it will automatically delete the methods in the custom DAO. XxxMapper is automatically generated through mybatis generator, and the methods in mapper are shown in the figure

.

clipboard.png

selectByUsernameUserMaper.xmlMavenselectByUsername

clipboard.png

clipboard.png

beginners learn, ask for answers! The worker"s body thanks to the waist!


has it been solved? Also ask


reason:
I use mybatis-generator to automatically generate dao and other code, and in the packaging process, he will execute the command of mybatis-generator automatic code generation again. The entire Mapper.java file will be replaced, so the custom method in Mapper.java must be gone.

solution:
after generating the relevant files, delete the mybatis-generator dependency in pom.xml and package it.

Welcome follow:
https://github.com/DianeDii

Menu