1、web pom文件增加配置
<plugin> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>1.3.5</version> <configuration> <configurationFile>src/main/resources/generatorConfig.xml</configurationFile> <verbose>true</verbose> <overwrite>true</overwrite> </configuration> <dependencies> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.38</version> </dependency> <dependency> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-core</artifactId> <version>1.3.5</version> </dependency> <dependency> <groupId>com.jd.ofc</groupId> <artifactId>jd-ofc-utils-mybatis</artifactId> <version>1.0-SNAPSHOT</version> </dependency> </dependencies> </plugin></plugins>2、web的resources下增加generatorConfig.xml配置文件,更改数据库配置,dao下的mapper文件、domain下的pojo文件、web下的xml文件位置。没有路径会自动创建。3、执行maven下的mybatis-generator。